You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
v3_signgleFetch future flag of Remix seems to be breaking remix redirection out of the app to the shopify admin. Example is with the the billing.request API call that should redirect to the charge approval page of the shopify admin.
Expected behavior
The merchant clicks on an "Upgrade plan" link that sends him to the "/subscribe" route. The route uses the billing api to request a charge and the merchant is redirected to the Charge approval page of the shopify admin.
Actual behavior
When navigating directly to the /subscribe route from the browser address bar, it functions as it should. If however you have a link within the app that sends the user to the /subscribe route, the process does not run and a "Handling response" message displays on the window.
Steps to reproduce the problem
Add billing configuration to the shopify.server.ts
import type { LoaderFunctionArgs } from '@remix-run/node';
import { shopify } from '~/shopify.server';
// substitute with the prefix of the store without the .myshopify.com suffix
const store = 'my-store';
// substitute with the app handle
const app = 'app-handle';
// name of the plan setup in shopify.server.ts
const plan = 'PAID_PLAN';
// annual or monthly interval
const interval = 'ANNUAL';
export const loader = async ({ request }: LoaderFunctionArgs) => {
const { billing } = await shopify.authenticate.admin(request);
return await billing.request({
plan,
lineItems: [],
isTest: true,
returnUrl: `https://admin.shopify.com/store/${store}/apps/${app}`,
});
};
The text was updated successfully, but these errors were encountered:
silintzir
changed the title
v3_singleFetch breaks the remix redirecting outside of the app to the shopify admin
v3_singleFetch breaks the remix redirecting outside of the app to the shopify admin (Handling Response)
Dec 5, 2024
It seems that for the client side navigations to this route, the new flag requires that the route exports the headers function otherwise the header x-shopify-api-request-failure-reauthorize-url that was set automatically before the v3 flag, now does not get set.
export const headers: HeadersFunction = (headers) => {
const mergedHeaders = new Headers();
for (const temp of Object.values(headers)) {
if (!temp) {
break;
}
temp.forEach((value, key) => {
mergedHeaders.set(key, value);
});
}
return mergedHeaders;
};
I reverted the flag in the template while I was investigating. Yes I was seeing as well the issue is caused because the failure to add the headers. We will be updating the package/template to work with the flag enabled.
Issue summary
Before opening this issue, I have:
@shopify
packages{ logger: { level: LogSeverity.Debug } }
in my configurationv3_signgleFetch future flag of Remix seems to be breaking remix redirection out of the app to the shopify admin. Example is with the the billing.request API call that should redirect to the charge approval page of the shopify admin.
Expected behavior
The merchant clicks on an "Upgrade plan" link that sends him to the "/subscribe" route. The route uses the billing api to request a charge and the merchant is redirected to the Charge approval page of the shopify admin.
Actual behavior
When navigating directly to the
/subscribe
route from the browser address bar, it functions as it should. If however you have a link within the app that sends the user to the/subscribe
route, the process does not run and a "Handling response" message displays on the window.Steps to reproduce the problem
Add billing configuration to the
shopify.server.ts
Create a route
subscribe
under routes:Add a Button using polaris anywhere in the app
The text was updated successfully, but these errors were encountered: