I am struggling with connecting my Shopify Test Store, through the API connection, with my code running on a docker container with the the server running on port 2000 inside Docker on my local machine. I am doing a port binding as follows: 3031:2000.
I am using the shopify-api-node library for NodeJS to connect with my Javascript code to the Shopify API and when trying to do any request to Shopify I get this
Error Image
I initialize my Shopify variable like this:
Shopify Variable
and when after creating the Shopify variable I do this:
Where the Error occurs
It never reaches the second log because the error is thrown. I already tried to remove the Do-While loop, but it does nothing. The only thing that I have made working is: when I run a quite similar code that I had before, without servers and without port bindings, just a Shopify API connection with the same library, same version, to the same store, running on a function and running that function on a Docker container, that works out. So, I guess it is just a Network issue, maybe some firewall with the PortBinding or it is passing the wrong url to send the response, or maybe it’s just hitting the wrong port. Maybe it is hitting the “127.0.0.1:3031”, but it needs to hit the “host.docker.internal:2000”, or the opposite.
Do you have any clue how to solve this? Any variable that I need to pass when declaring the Shopify variable to change the redirect URL or the response URL to the correct URL?
Thank you very much for your help!