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 · 2 comments · May be fixed by #1999
Open
4 of 5 tasks

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

McTom234 opened this issue Dec 15, 2024 · 2 comments · May be fixed by #1999

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).

@McTom234 McTom234 linked a pull request Jan 22, 2025 that will close this issue
6 tasks
Copy link
Contributor

We're labeling this issue as stale because there hasn't been any activity on it for 60 days. While the issue will stay open and we hope to resolve it, this helps us prioritize community requests.

You can add a comment to remove the label if it's still relevant, and we can re-evaluate it.

@github-actions github-actions bot added the Stale label Feb 14, 2025
@McTom234
Copy link
Author

Dear maintainers, is it worth working on the other clients or would you reject the PR even if the tests weren't failing?

@github-actions github-actions bot removed the Stale label Feb 18, 2025
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

Successfully merging a pull request may close this issue.

1 participant