Closed michaelashe closed 3 years ago
Hi to expand on the above We are using
@commercetools-frontend/mc-scripts16.16.3, @commercetools-frontend/application-shell16.16.5 @commercetools-frontend/sdk": "16.16.1
We when we build/start the custom application with mc scripts start to develop we build a customApplication config (.custom-application-config.json) and dynamically create an ngrok tunnel which proxies to our localhost and which is added to the config via the additionalEnv properties. { "name": "[Name]", "entryPointUriPath": "[Entry url]", "cloudIdentifier": "gcp-eu", "additionalEnv":
{ "apiDomain": "https://4238b2d11e2f.ngrok.io" } , "env": { "production":
{ "url": "some address" } } }
When the custom application starts, we log in to the project, and arrive at our custom page and the additional env variable apiDomain is available to the frontend code and we can use a this as the target for the javascript SDK to async forward this get request retrieve information via the gateway to ngrok which previously proxied it to the local machine where the access token is validated. There we retrieve the order details from commerce tools using the dotnet sdk and some other handling around payments and the information returned to the merchant center application
return actions.forwardTo.get({
uri: ${apiDomain}/${api-end-point}/{id}
});
We get a 404 response that the tunnel is not found and the request never reaches the endpoint or the token validation.
I expected a 200 response, with the data from the api having been successful forwarded to ngrok.
Calling the exact forward-to address (https://9b921bdd670d.ngrok.io/backend/api/orderedits/directrefunds/2894e527-9774-4f48-93ef-0ba0a044b60e) in postman is successful.
Calling https://mc-api.europe-west1.gcp.commercetools.com/proxy/forward-to with the x-forward-to property set: https://9b921bdd670d.ngrok.io/backend/api/orderedits/directrefunds/2894e527-9774-4f48-93ef-0ba0a044b60e results in a 404
change the forward-to to: https://mc-api.europe-west1.gcp.commercetools.com you get a 200.
Hi @csi-lund , thanks for the detailed explanation. We'll look into that and come back to you.
@csi-lund I checked our logs and I couldn't find any meaningful log about the 404 responses.
I also just tried out a cURL request using ngrok and it works as expected. See
Can you check that the request being sent to the MC API is "correct" and contains all the necessary headers?
Thanks for looking into it ill check it out again
Hi @emmenko unfortunately this is still not working for me, I will double check with another colleague again to see if he experiences the same.
Heres the ngrok: https://8252-217-115-58-195.ngrok.io/
I managed to cause a 500 error by removing the protocol. cUrl: (500) & (400) The same was reproducible from postman
from with the custom app still 404
Here is failing to forward to ngrok with a curl and then it working straight to ngrok with the token (bottom)
Its definitely me, works for a colleague . The question is why....
This can be closed, this was an issue with ngrok, auth token
Thanks for reaching out and glad we solved it :)
Hi I am developing locally a merchant center extension which has until recently been working okay but now I am experiencing and issue which prevents me for working.
We use ngrok to proxy the request from merchant center gateway development server to our local development machine via the merchant centre gateway. However every request to ngrox receives a 404 tunnel not found response.
When I use the accesstoken I see forwarded with the 404 request from the local mcapp and call the ngrok x-forward-to address directly with postman I can see the request reach our server authenticate with merchant center endpoint and respond with 200.
Is there anything that is preventing us from reaching the tunnel? I can see the tunnel is up (note my api is not in the last image hence why its fails to connect) But both this and the postman show that the tunnel is up at ngrox and proxying requests and that the api is validating the mcToken correctly. So what could stop us from reaching it
Thanks for your help in advance.
Further details provided at {{SUPPORT-13260}}. Omitted here to avoid possibly sensitive data exposure.