Shopify: request offline access tokens for background jobs via isOnline false
Shows how to fix shopify: request offline access tokens for background jobs via isOnline false. Use it when you hit this exact problem. Skip it when your error message or symptom looks different.
TL;DR
When a background job needs Shopify API access, dont reuse the online token from the user session. Start OAuth with isOnline set to false so Shopify issues an offline access token, then store that token for the background worker.
Steps
- When a background job needs Shopify API access, dont reuse the online token from the user session. Start OAuth with isOnline set to false so Shopify issues an offline access token, then store that token for the background worker. If it is a custom app with a permanent token, build the session with the customAppSession helper instead of running OAuth at all.
When to use
You are seeing this: For custom apps, the session helper customAppSession builds the session directly. Use this skill when you run into "Shopify: request offline access tokens for background jobs via isOnline false".
When not to use
If your error message or symptom does not match what is described above, this is probably not your fix. Search for your exact error text instead of forcing this one to fit.
Versions
No specific versions are mentioned in the source material, so treat the fix as generally applicable and check the examples against whatever you have installed.
Why this happens
The original report does not dig into a root cause. It documents the symptom and the fix that resolved it.
Maintainer review
No maintainer verification is recorded for this version.
This records the version a maintainer checked. It does not assert that the version is the latest upstream release.