Hello,
Is the [createHydrogenContext()](https://shopify.dev/docs/api/hydrogen/2024-10/utilities/createhydrogencontext)
only work for the Hydrogen Sales Channel and not for the Headless Sales Channel?
Hello,
Is the [createHydrogenContext()](https://shopify.dev/docs/api/hydrogen/2024-10/utilities/createhydrogencontext)
only work for the Hydrogen Sales Channel and not for the Headless Sales Channel?
Hey @junerockwell
createHydrogenContext
is for use in Hydrogen. It shouldn’t matter whether you generate the storefront token via Hydrogen sales channel or Headless sales channel.
What are you trying to achieve / can I help with something?
Hi @scottdixon. Thanks for replying. I do need help.
I get a 500 error saying that I don’t have the valid credentials to use Customer Account API (/account). See screenshot attached.
But I have the Headless Sales Channel installed. I have the following variables in the .env
and they have been filled from the data from the Headless Sales Channel:
SESSION_SECRET="foobar"
PUBLIC_STORE_DOMAIN="***.myshopify.com"
PUBLIC_STOREFRONT_ID="*****"
PUBLIC_STOREFRONT_API_TOKEN="*****"
PRIVATE_STOREFRONT_API_TOKEN="shpat_****"
PUBLIC_CUSTOMER_ACCOUNT_API_CLIENT_ID="shp_*****"
I have an Ngrok tunneling. I would npm run dev
first. And then on another Terminal, I would start the Ngrok afterwards.
What am I missing? I don’t need to overwrite createHydrogenContext()
with [createCustomerAccountClient()](https://shopify.dev/docs/api/hydrogen/2024-10/utilities/createcustomeraccountclient)
, correct?
I’m using the Remix Hydrogen FrontEnd, and have just upgraded from 2024.7.x
version to 2024.10.0
.
That’s right, createHydrogenContext
should take care of the customer account client.
That error is a bit of a catch all. Can you try adding a SHOP_ID to your .env
file? As in SHOP_ID=12345..
. Try h2 env pull
(not sure if this will work with Headless channel). Otherwise you can obtain the ID from https://admin.shopify.com/store/.../shop.json
If this doesn’t solve it find me on the Partner Slack (@scottdixon) and we can pair to debug!
Hi @scottdixon! Thanks again for replying.
Two things:
Hey @junerockwell!
https://admin.shopify.com/store/my-shop
, add /shop.json
to get https://admin.shopify.com/store/my-shop/shop.json
@scottdixon Thank you!!!