diff --git a/index.js b/index.js index 92262fb..48aad51 100644 --- a/index.js +++ b/index.js @@ -223,9 +223,9 @@ class ServerlessPlugin { }); // Compare apples-to-apples (configured-to-deployed) and record deployment status - if (this.cache.deployedAPIs.some(deployedAPI => deployedAPI.apiClob === apiDefClob)) { - const apiStatus = this.cache.deployedAPIs.find(deployedAPI => deployedAPI.apiClob === apiDefClob).apiStatus; - const apiId = this.cache.deployedAPIs.find(deployedAPI => deployedAPI.apiClob === apiDefClob).apiId; + if (this.cache.deployedAPIs.some(deployedAPI => deployedAPI.apiClob == apiDefClob)) { + const apiStatus = this.cache.deployedAPIs.find(deployedAPI => deployedAPI.apiClob == apiDefClob).apiStatus; + const apiId = this.cache.deployedAPIs.find(deployedAPI => deployedAPI.apiClob == apiDefClob).apiId; var invokableAPIURL = null; // Check for PUBLISHED state, if PUBLISHED then retrieve Invokable API URL @@ -247,6 +247,7 @@ class ServerlessPlugin { apiVersion: apiDef.version, apiContext: apiDef.rootContext, apiStatus: apiStatus, + apiId, apiId, invokableAPIURL: invokableAPIURL + " 🚀", }); } @@ -256,6 +257,7 @@ class ServerlessPlugin { apiVersion: apiDef.version, apiContext: apiDef.rootContext, apiStatus: "TO BE CREATED", + apiId: null, invokableAPIURL: "TO BE CREATED", }) } diff --git a/src/2.6.0/wso2apim.js b/src/2.6.0/wso2apim.js index 39cefc5..7fa02fa 100644 --- a/src/2.6.0/wso2apim.js +++ b/src/2.6.0/wso2apim.js @@ -349,7 +349,7 @@ async function uploadCert(url, accessToken, certAlias, certFile, backendUrl) { // Updates API definition async function updateAPIDef(url, user, accessToken, gatewayEnv, apiDef, apiId) { try { - url = "url + "/"" + apiId; + url = url + "/" + apiId; var data = constructAPIDef(user, gatewayEnv, apiDef, apiId); var config = { headers: {