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

fix(shopify-api): 301 redirect follows with initial method #1999

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

McTom234
Copy link

WHY are these changes introduced?

Fixes #1868

node-fetch follows redirects always with GET. The HTTP Spec allows this for historical reasons.

This behavior is problematic, when trying to access a shop's API when only a custom domain is given.

  • Custom domain: example.com
  • My Shopify domain: custom-1234.myshopify.com
    The request to the GraphQL API fails, because the request is redirected from the custom domain to the My-Shopify domain. During this redirect, node-fetch swaps the method to GET which results in a 404 response.

WHAT is this pull request doing?

This pull request implements a node-fetch fetch wrapper that handles redirects manually.

Type of change

  • Patch: Bug (non-breaking change which fixes an issue)
  • Minor: New feature (non-breaking change which adds functionality)
  • Major: Breaking change (fix or feature that would cause existing functionality to not work as expected)

Checklist

  • I have used pnpm changeset to create a draft changelog entry (do NOT update the CHANGELOG.md files manually)
  • I have added/updated tests for this change
  • I have documented new APIs/updated the documentation for modified APIs (for public APIs) (comment: needed?)

@McTom234 McTom234 requested a review from a team as a code owner January 22, 2025 13:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[shopify-api] GraphQL request with custom shop domain is not working
1 participant