Hi everyone — looking for help with an embedded app redirect issue during billing.
- Stack: Remix +
@shopify/shopify-app-remix, Prisma session storage, App Bridge, Polaris - Auth:
authenticate.admin(request)with embedded app (App Store distribution) - Billing:
appSubscriptionCreatewith confirmation URL, then return to/app/billing
Problem
When the merchant approves the subscription in Shopify’s confirmation screen, the redirect back to my app lands on /app/billing, but I immediately get bounced to the auth flow asking for the shop domain (as if the session is gone).
Example redirect URL after confirmation:
/app/billing?embedded=1&hmac=...&host=YWRtaW4uc2hvcGlmeS5jb20vc3RvcmUvMDBxeG5lLWV0&id_token=...&locale=en&session=...&shop=00qxne-et.myshopify.com×tamp=...
What I’m doing now
- Creating the subscription:
returnUrlis built as:const host = new URL(request.url).searchParams.get('host')const appBase = process.env.SHOPIFY_APP_URL || currentOriginconst returnUrl = ${appBase}/app/billing${host ? ?host=${host}&embedded=1 : ''}
- Server returns
confirmationUrlJSON (no server-side redirect). - Client does:
useEffect(() => {
if (actionData?.success && actionData.confirmationUrl) {
window.open(actionData.confirmationUrl, '_top');
}
}, [actionData]);
- On return, the URL includes
host,embedded=1,shop,session, butauthenticate.admin(request)still triggers login asking for shop.
Relevant config
shopifyApp({ appUrl: process.env.SHOPIFY_APP_URL, authPathPrefix: '/auth', sessionStorage: new PrismaSessionStorage(prisma), distribution: AppStore, future: { unstable_newEmbeddedAuthStrategy: true } })SHOPIFY_APP_URLis set to the public HTTPS domain.- Sessions persist fine elsewhere; only this billing return path exhibits the issue.
What I’ve tried
- Server-side redirect vs. client
window.open('_top') - Ensuring
returnUrlmatchesSHOPIFY_APP_URLhost + https - Preserving
host+embedded=1onreturnUrl - Verifying the route is loaded within the embedded context (has
host,embedded=1) - Confirmed session tables are writable and used for other routes