Next.js Starter Storefront Login Page Error on Google Cloud Run

The Next.js Starter Storefront uses parallel routes to show account pages. However, there's a reported error when hosting Next.js with parallel routes on Google's Cloud Run, where the error stops working.

Why this Error Occurred#

This error occurs because Google Cloud Run decodes chunk URLs, but Next.js expects them to be encoded.


How to Fix it#

To resolve the error, add the following rewrites in your Next.js Starter Storefront's next.config.ts file:

next.config.ts
1const nextConfig = {2  // ... other config3  rewrites: async () => {4    return {5      beforeFiles: [6        {7          source: "/_next/static/chunks/app/:folder*/@login/:path*",8          destination: "/_next/static/chunks/app/:folder*/%40login/:path*",9        },10        // Repeat this pattern if other similar errors occur11      ],12      afterFiles: [],13      fallback: [],14    }15  },16}

You can add the rewrite to other parallel routes you have in your application. For example, if you have a /@dashboard route, you can add a rewrite for it as well.

Was this page helpful?
Ask Bloom
For assistance in your development, use Claude Code Plugins or Docs MCP server in Cursor, VSCode, etc...FAQ
What is Medusa?
How can I create a module?
How can I create a data model?
How do I create a workflow?
How can I extend a data model in the Product Module?
Recipes
How do I build a marketplace with Medusa?
How do I build digital products with Medusa?
How do I build subscription-based purchases with Medusa?
What other recipes are available in the Medusa documentation?
Chat is cleared on refresh
Line break
⇧↵