Skip to content

Conversation

blittle
Copy link

@blittle blittle commented May 19, 2025

WHY are these changes introduced?

Allow tokenless requests to the SFAPI.

WHAT is this pull request doing?

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)

@blittle blittle requested a review from a team as a code owner May 19, 2025 17:36
Copy link
Contributor

@lizkenyon lizkenyon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for this contribution! I tried testing this out locally, and it didn't quite work for me.
image

I didn't fully look into the issue but I think it is because we are still trying to set the header, but the value is empty.

There looks like there is more logic that we will need to modify, where we previously assumed private token usage when the public token was not supplied

We also need to update the readme TY!

@blittle
Copy link
Author

blittle commented May 23, 2025

I didn't fully look into the issue but I think it is because we are still trying to set the header, but the value is empty.

@lizkenyon thank you for checking it out. I can update the logic to not set the header at all if it's not provided. We are already patching this successfully in storefront-components, so I'm curious to see the exact example that you caused a failure. Thank you!

@lizkenyon
Copy link
Contributor

@blittle

I tested the storefront API client with a little node script like this.

import {createStorefrontApiClient} from '@shopify/storefront-api-client';

const client = createStorefrontApiClient({
  storeDomain: 'liz-dev-5.myshopify.com',
  apiVersion: '2025-04'
});

const shopQuery = `
  query products {
    products(first: 10) {
      edges {
        node {
          id
          title
          handle
          description
          createdAt
          updatedAt
        }
      }
    }
  }
`;

const {data, errors, extensions} = await client.request(shopQuery);

console.log(JSON.stringify(data, null, 2), "data");
console.log(errors, "errors");
console.log(extensions, "extensions");

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 this pull request may close these issues.

3 participants