Description
Trying to set up an app proxy page that renders a form using React. The page should render in the context of the theme (ie. show the header and footer), but even with a bare bones example on a brand new app, it is not functional.
Following the examples from here: https://shopify.dev/docs/api/shopify-app-remix/v3/app-proxy-components/appproxyprovider and here: https://shopify.dev/docs/api/shopify-app-remix/v3/authenticate/public/app-proxy and using a fresh app created today.
Request url: https://test.myshopify.com/apps/proxy/test-page/
Shopify.app.toml:
[app_proxy]
url = "https://reform-mason-managed-capable.trycloudflare.com"
subpath = "proxy"
prefix = "apps"
Route markup (app/routes/test-page.jsx
)
import { authenticate } from "../shopify.server";
import { useLoaderData } from "@remix-run/react";
import { AppProxyProvider } from "@shopify/shopify-app-remix/react";
import { useState } from "react";
export async function loader({ request }) {
await authenticate.public.appProxy(request);
return { appUrl: process.env.SHOPIFY_APP_URL };
}
export default function App() {
const { appUrl } = useLoaderData();
const [count, setCount] = useState(0);
return (
<AppProxyProvider appUrl={appUrl}>
<div>
<p>You clicked {count} times</p>
<button onClick={() => setCount(count + 1)}>Click me</button>
<div>{appUrl}</div>
</div>
</AppProxyProvider>
);
}
Problems:
- In the documentation and responses to other github issues it implies that the route file should be located at
app/routes/proxyPrefix.proxySubpath.route.tsx
. This does not work and results in a 404. Moving the route file toapp/routes/route.tsx
does return the markup correctly.

- CORS errors: after digging through a bunch of issues, I found this: Update vite cors settings #977. Since I'm using a new app, those changes are already configured. I added an
origin
property to Vite config, which seems to resolve the CORS thing, but this is not scalable and doesn't seem like a recommended solution.
export default defineConfig({
server: {
allowedHosts: [host],
cors: {
preflightContinue: true,
origin: [
`https://test.myshopify.com`
],
},
...
- After resolving (maybe) the CORS issues, there are hydration errors. The html momentarily shows, then this error appears:

In the console there are numerous errors:
Uncaught Error: Hydration failed because the initial UI does not match what was rendered on the server
Hoping for some guidance in how to resolve this, as it seems like the basic functionality of app proxy within the template, including theAppProxyProvider
component is not functional, or there is some critical piece of documentation that is missing.