MaxRedirectsError on NodeJS API library when doing a simple request

Topic summary

A developer is encountering a MaxRedirectsError when using the shopify-api-node library for NodeJS to connect to a Shopify Test Store from within a Docker container.

Setup Details:

  • Server runs on port 2000 inside Docker
  • Port binding configured as 3031:2000
  • Error occurs when attempting any Shopify API request
  • The Shopify connection is initialized with standard credentials

Key Observations:

  • The code fails before reaching subsequent log statements
  • A similar setup without servers/port bindings works successfully on Docker
  • Developer suspects network/firewall issues related to port binding or incorrect URL routing

Suspected Issues:

  • Requests may be hitting 127.0.0.1:3031 instead of host.docker.internal:2000 (or vice versa)
  • Possible redirect URL or response URL misconfiguration

Current Status:
The issue remains unresolved. Another user has reported experiencing the same error, but no solutions have been provided yet.

Summarized with AI on November 1. AI used: claude-sonnet-4-5-20250929.

Hello,

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:

I initialize my Shopify variable like this:

and when after creating the Shopify variable I do this:

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!

I am facing the same error, if anyone knows anything about this, please share your expertise here Thank You.