Solved

Storefront API client problems - access denied and/or headers.get is not a function

colinmcg
Shopify Partner
2 1 0

I'm trying to use the storefront API client to query metaobjects in our store. So far I have not been able to get a successful response from the Shopify GraphiQL app or from our client-side JS. But, when I test the request from Insomnia app it's successful.

 

From GraphiQL app - I get an ACCESS_DENIED error saying that scope needs to be turned on, but can see in my Headless storefront settings it is definitely on. Strangely I am able to successfully query shop or products, just not metaobjects. Also, the metobjects query does work via the Admin API

 

From JS - I have tried the @Shopify/storefront-api-client package (both as npm package & loading via CDN). Either way I get the following error response:

{message: '_t3.headers.get is not a function'}

We've also tried dropping the library and just using fetch, which results in a 403 response code. 

 

This has been stumping us for a couple days, if anyone has thoughts or ideas as to what could be going on I would really appreciate it.

 

Our last resort is to stand up our own server/endpoint and use the Admin API because we know that does work, but we'd like to avoid that and just use Storefront API directly from the browser.

 

 

 

 

Accepted Solution (1)

colinmcg
Shopify Partner
2 1 0

This is an accepted solution.

Just an update in case any is encountering this same issue - wasn't able to figure out why the Storefront client and native fetch was erroring, or the GraphiQL issue. But, was able to get a successful response using XMLHttpRequest 

View solution in original post

Reply 1 (1)

colinmcg
Shopify Partner
2 1 0

This is an accepted solution.

Just an update in case any is encountering this same issue - wasn't able to figure out why the Storefront client and native fetch was erroring, or the GraphiQL issue. But, was able to get a successful response using XMLHttpRequest