Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deploying API's to separate gateway environments not working as expected #2342

Closed
ug205 opened this issue Dec 22, 2023 · 0 comments · Fixed by wso2/carbon-apimgt#12208
Closed

Comments

@ug205
Copy link

ug205 commented Dec 22, 2023

Description

In APIM 4.2.0.54 when we deploy a fully distributed APIM with 2 gateway environments, when deploying APIs by 'Deploy' step and choose both Production and Sandbox environments we observe the following.
Open the deployed API in the sandbox environment and observe that the is filtering for the wrong key type (Production).

Steps to Reproduce

Steps to reproduce:

  1. Configure 2 GWs as mentioned above and set gateway_labels =["Production"] and gateway_labels =["Sandbox"] respectively.

[[apim.gateway.environment]]
name = "Production"
type = "production"
provider = "wso2"
...

[[apim.gateway.environment]]
name = "Sandbox"
type = "sandbox"
provider = "wso2"
....

  1. Enable api persistance in the file system to see the actual deployed API. Restart Servers

[apim.sync_runtime_artifacts.gateway]
gateway_labels =["Production"]

  1. Create an API with both Production and Sandbox endpoints

  2. In the Deploy step choose both Production and Sandbox environments and click deploy.

  3. Open the deployed API in the sandbox environment. This is filtering for the wrong key type.

<api xmlns="http://ws.apache.org/ns/synapse"
     name="TestApi2"
     context="/testapi2/v1"
     version="v1"
     version-type="context"
     binds-to="default">
   <resource methods="GET"
             binds-to="default"
             url-mapping="/*"
             faultSequence="fault">
      <inSequence>
         <property name="api.ut.backendRequestTime"
                   expression="get-property('SYSTEM_TIME')"/>
         <filter source="$ctx:AM_KEY_TYPE" regex="PRODUCTION">  <---- This should be SANDBOX in the good scenario
            <then>
               <send>
                  <endpoint key="TestApi2--vv1_APIproductionEndpoint"/>
               </send>
            </then>
            <else>
               <payloadFactory media-type="xml">
                  <format>
                     <error xmlns="">
                        <message>Sandbox Key Provided for Production Gateway</message>
                     </error>
                  </format>
                  <args/>
               </payloadFactory>

Affected Component

APIM

Version

420

Environment Details (with versions)

No response

Relevant Log Output

No response

Related Issues

No response

Suggested Labels

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants