Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dynamic catch-all routes not supported in Google App Engine #10556

Closed
sanders54 opened this issue Feb 17, 2020 · 19 comments
Closed

Dynamic catch-all routes not supported in Google App Engine #10556

sanders54 opened this issue Feb 17, 2020 · 19 comments
Labels
Upstream Related to using Next.js with a third-party dependency. (e.g., React, UI/icon libraries, etc.).

Comments

@sanders54
Copy link

sanders54 commented Feb 17, 2020

Issue with filename-name causing deploy error in Google App Engine

Describe the bug

I've had a nextJS app running in the Google App Engine enviroment for a while. Works splendid and fast - however, I added a dynamic route and now I am unable to deploy due to the filename being unsupported (due to the 3 dots).

Error from the Gcloud CLI:

ERROR: (gcloud.app.deploy) INVALID_ARGUMENT: Filename cannot contain '.', '..', '\r', start with '-', '_ah/', or '\n': pages/[...slug]/index.js.

One fix could be using underscore or similar instead, like "[___slug]"

To Reproduce

Deploy the app to Google App Engine using any boilerplate configuration for app.yaml with a dynamic catch all route. Use below example and add a catch-all page.

https://github.com/superbmeteor/nextjs-gae-demo

Expected behavior

Should deploy successfully.

@wieringen
Copy link

I'm also having this problem. The problem only occurs on the App Engine Standard environment.

@gmosx
Copy link

gmosx commented Mar 15, 2020

Now, this is extremely annoying :(

@B1rch
Copy link

B1rch commented Mar 24, 2020

I'm running into this problem right now as well. Any known workarounds would be greatly appreciated

@jeroenoomsNL
Copy link

Same problem here! It's blocking our project at the moment.

@sanders54
Copy link
Author

sanders54 commented Mar 31, 2020

Same problem here! It's blocking our project at the moment.

Same here. One workaround is to duplicate code for every sub-path (I did for 3 levels)

@jeroenoomsNL
Copy link

Same problem here! It's blocking our project at the moment.

Same here. One workaround is to duplicate code for every sub-path (I did for 3 levels)

Do you have an example of what you did to achieve this?

@wieringen
Copy link

I think he created the same workaround I did. Import and directly export the associated route component in every subpath, which in essence will duplicate that component for every subpath.

@sanders54
Copy link
Author

That's correct - I didn't see this before now.

@dorli
Copy link

dorli commented Apr 18, 2020

Anyone has a workaround without duplicating code for every path ?

@sanders54
Copy link
Author

Anyone has a workaround without duplicating code for every path ?

Not that I'm aware of. Hopefully this is fixed soon!

@xe4me
Copy link

xe4me commented May 20, 2020

This is blocking our production release :(

@mykolat
Copy link

mykolat commented May 21, 2020

+1

@jsiddiqui
Copy link

I made the following workaround and it seems to work fine.

"gcp-predeploy": "find .next -name '\\[...*' -exec bash -c 'mv \"$1\" \"${1/.../@@@}\"' -- {} \\;",
"gcp-build": "find .next -name '\\[@@@*' -exec bash -c 'mv \"$1\" \"${1/@@@/...}\"' -- {} \\;",
"start": "next start -p ${PORT:-3000}",

Invoke yarn gcp-predeploy after building and before deploying to change ... to @@@ for uploading. The gcp-build steps renames it back on the app-engine instance. A small disadvantage of having a gcp-build step is that all dependencies are installed (including dev) for the gcp-build step and then cleared and then again for the start step, slightly increasing instance startup time. Note that we cannot rename inside the start script as the file system is read-only at that time.

@sanders54
Copy link
Author

... slightly increasing instance startup time. Note that we cannot rename inside the start script as the file system is read-only at that time.

How much increased startup time did you see? I have an application where every MS counts.

@Timer Timer added the Upstream Related to using Next.js with a third-party dependency. (e.g., React, UI/icon libraries, etc.). label Jun 25, 2020
@Timer
Copy link
Member

Timer commented Jun 25, 2020

Did anyone file a bug report with GAE to allow this valid file name?

@sanders54
Copy link
Author

Did anyone file a bug report with GAE to allow this valid file name?

Yes. I reported it through GAE feedback about the same time. I'm not sure what channel to report that specific thing to.

@rish-hub
Copy link

How shall I deploy the next.js app on compute engine, any idea.
So far I pulled everything from Github and did a npm install.
I tried running it using PM2 but unable to see on the external IP /Link of google compute engine

@sanders54
Copy link
Author

@Timer Google has fixed this on their end now. Closing issue.

@balazsorban44
Copy link
Member

This issue has been automatically locked due to no recent activity. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.

@vercel vercel locked as resolved and limited conversation to collaborators Jan 29, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Upstream Related to using Next.js with a third-party dependency. (e.g., React, UI/icon libraries, etc.).
Projects
None yet
Development

No branches or pull requests