Session token missing sometimes

Edit: This is in regards to our full-page Customer Account UI Extension

We have a guard clause in our API endpoints that throws when we’re missing the JWT that comes from await sessionToken.get(). This has been throwing errors more often than I anticipated, resulting in blank extension page loads for affected customers. It is not obvious how exactly we should handle this, we haven’t been able to reproduce it so we don’t actually know what to suggest to the customer when/if this happens.

The error we’re throwing is specifically that the token is missing, not invalid.

What are the conditions for that API to not return a session token at all? I assumed it was guaranteed that there would always be a valid session token considering they can’t load our extensions if they’re not authed correctly. I would appreciate any insight here.

Edit: I’ve included some snippets from our code to demonstrate our current usage of session tokens. It is not clear to me how the token could be missing here? We have logs of this fetch call resulting in a 500 error regarding the missing session token.

1 Like

Why are you manually adding the Bearer token? fetch() is already overridden by App Bridge and automatically attaches the latest session token.

Apologies, I should have clarified further than just adding a tag to the post. This is an issue we’re having with our customer account UI extension, not our app.