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

[shopify-api] GraphQL request with custom shop domain is not working #1868

Open
4 of 5 tasks
McTom234 opened this issue Dec 15, 2024 · 0 comments
Open
4 of 5 tasks

[shopify-api] GraphQL request with custom shop domain is not working #1868

McTom234 opened this issue Dec 15, 2024 · 0 comments

Comments

@McTom234
Copy link

McTom234 commented Dec 15, 2024

Issue summary

Before opening this issue, I have:

  • Upgraded to the latest version of the relevant packages
    • @shopify/* package and version: 11.6.1
    • Node version: 20.11.1
    • Operating system: Linux
  • Set { logger: { level: LogSeverity.Debug } } in my configuration, when applicable
  • Found a reliable way to reproduce the problem that indicates it's a problem with the package
  • Looked for similar issues in this repository
  • Checked that this isn't an issue with a Shopify API

TL;DR: custom shop domains cannot be used with this library, due to a wrong redirect handling.

Prerequisites:

  • shop A has a custom domain a.com
  • you have valid credentials for shop A to make API requests (tested by using the Location header of the redirect response)

The request to the GraphQL endpoint for shop A on a.com/... returns a 301 response and redirects to the shop's {shop}.myshopify.com host. The default redirect handling of a 301 response in node-fetch is to set the request method to GET. That results in a 404 response on the API (which I think is not optimal - see 405; but this is an API, not library issue).

Expected behavior

  • The Shopify API should return a 308 for this request.
  • The Shopify API client should handle the redirect for GraphQL requests to use a POST request again.

Actual behavior

  • The Shopify API returns a 301, which resets the request method to GET, as this is the node-fetch default.

Steps to reproduce the problem

I'd say, the explanation does a quite good job for this...

Other

This is partly a Shopify API issue. But the library should be able to handle this case (imo).

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

No branches or pull requests

1 participant