|
1
|
The Next.js Starter Storefront uses parallel routes to show account pages. However, there's a [reported error](https://github.com/vercel/next.js/issues/71626) when hosting Next.js with parallel routes on Google's Cloud Run, where the error stops working. |
|
2
|
|
|
3
|
## Why this Error Occurred |
|
4
|
|
|
5
|
This error occurs because Google Cloud Run decodes chunk URLs, but Next.js expects them to be encoded. |
|
6
|
|
|
7
|
--- |
|
8
|
|
|
9
|
## How to Fix it |
|
10
|
|
|
11
|
To resolve the error, add the following rewrites in your Next.js Starter Storefront's `next.config.ts` file: |
|
12
|
|
|
13
|
```ts title="next.config.ts" |
|
14
|
const nextConfig = { |
|
15
|
// ... other config |
|
16
|
rewrites: async () => { |
|
17
|
return { |
|
18
|
beforeFiles: [ |
|
19
|
{ |
|
20
|
source: "/_next/static/chunks/app/:folder*/@login/:path*", |
|
21
|
destination: "/_next/static/chunks/app/:folder*/%40login/:path*", |
|
22
|
}, |
|
23
|
// Repeat this pattern if other similar errors occur |
|
24
|
], |
|
25
|
afterFiles: [], |
|
26
|
fallback: [], |
|
27
|
} |
|
28
|
}, |
|
29
|
} |
|
30
|
``` |
|
31
|
|
|
32
|
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. |