I am experiencing a 500 Internal Server Error when my app tries to exchange an ID token for an offline access token using the /admin/oauth/access_token endpoint. This issue only occurs in my production environment (AWS App Runner); everything works as expected in development.
The response from Shopify is always a 500 error with no body or headers.
- My app is using the official
@shopify/shopify-app-remixSDK and the same credentials work in development.
Troubleshooting steps taken:
-
Verified all environment variables and credentials.
-
Confirmed app is installed and API scopes are correct.
-
Enabled debug logging in the SDK, but no additional error details are provided.
Logs:
[shopify-app/INFO] Authenticating admin request
[shopify-app/DEBUG] Attempting to authenticate session token | {sessionToken: {"search": "[REDACTED]"}}
[shopify-app/DEBUG] Validating session token
[shopify-app/DEBUG] Session token is valid | {payload: [REDACTED] }
[shopify-app/DEBUG] Session token is valid | {shop: vurdere-luisa.myshopify.com, payload: [object Object]}
[shopify-app/DEBUG] Loading session from storage | {sessionId: offline_vurdere-luisa.myshopify.com}
[shopify-app/INFO] No valid session found
[shopify-app/INFO] Requesting offline access token
[shopify-api/DEBUG] Making HTTP request | {method: POST, url: https://vurdere-luisa.myshopify.com/admin/oauth/access_token, body: {"client_id":"[REDACTED]","client_secret":"[REDACTED]","grant_type":"urn:ietf:params:oauth:grant-type:token-exchange","subject_token":"[REDACTED]","subject_token_type":"urn:ietf:params:oauth:token-type:id_token","requested_token_type":"urn:shopify:params:oauth:token-type:offline-access-token"}}
[shopify-app/DEBUG] Authenticate returned a response
[my app's logs]
Response status: 500
Response headers:
{}
Response body:
⚠️ Error: Response {
status: 500,
statusText: 'Internal Server Error',
headers: Headers
{}
,
body: null,
bodyUsed: false,
ok: false,
redirected: false,
type: 'default',
url: ''
}
GET /?embedded=1&hmac=[REDACTED]&host=[REDACTED]&id_token=[REDACTED]&locale=en&session=[REDACTED]&shop=vurdere-luisa.myshopify.com×tamp=1761086795 500 - - 270.792 ms
GET /healthz 200 - - 3.224 ms
Could you please help me understand why this error is occurring in production and how to resolve it?
If you need more details or logs, I can provide them.
Thank you!