sessionToken error when adding the app block

Hi, when I’m trying to add my app block (checkout ui extension) on the thank you page in the checkout editor, the app is supposed to show in the preview, but it doesn’t because the session token isn’t working (the app fetches data from my backend using this token). I get this error: SessionTokenNotFoundError: no session token in data.

const { sessionToken } = useApi("purchase.thank-you.block.render");
const token = await sessionToken.get()

If I just save and refresh the page, the session token works and everything functions correctly. This only happens during the initial render when I add the block. Also, the error only appears on a real pay store, not on a development store.

When I test adding the block with the browser console open in network, I see a grapql request “graphql?operationName=CheckoutExtensionSessionToken” with an app id and an extensionActivationId. Here we see that the request returns nothing, whereas in the development store there’s a token in return, with a real pay shop if you save and update, it works fine also there is a token. It’s only when the block is first added.

Network access / API access are correctly allowed.

Do you have any ideas ? Thank you.

I’m encountering the same error now. Did you ever resolve it?

I have not tested it within a real store, but am testing and observing the issue of SessionTokenNotFoundError when adding the widget in the store’s widget configuration screen.

I’m unsure if it’s an access scope issue and have toyed with a couple additional new scopes. But none seem to have resolved the session issue.

No i still have the same error (only with real store).

Same. I tested it on a live store, and it works at least. So I’m not too perturbed.

For those looking later, token.get continues to fail on a real store in the edit screen.

1 Like