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

Assertion failed: len < MAX_ENV_VAR_LENGTH #23

Open
pimlie opened this issue Jan 16, 2020 · 11 comments
Open

Assertion failed: len < MAX_ENV_VAR_LENGTH #23

pimlie opened this issue Jan 16, 2020 · 11 comments

Comments

@pimlie
Copy link
Member

pimlie commented Jan 16, 2020

The master sends the nuxt.config through an env var to the worker. On windows there appears to be a limit of passing env vars of 32KB (possibly since node v12.10), if you exceed that limit libuv will throw an error.

Possible fixes:

  • zip the env
  • use disk
This question is available on Nuxt community (#c13)
@ghost ghost closed this as completed Jan 16, 2020
@ghost ghost added the cmty:question label Jan 16, 2020
@nuxt-community nuxt-community deleted a comment Jan 16, 2020
@pimlie pimlie reopened this Jan 16, 2020
@aldarund
Copy link
Member

serverMiddleware serialization will cause generate workers to fail.
as solution -> exclude config key customization

@pimlie
Copy link
Member Author

pimlie commented Jan 17, 2020

v2.7.0 includes a beforeWorkers hook you can use to exclude keys

@lxsedov
Copy link

lxsedov commented Jan 28, 2020

how many urls can nuxt-generate-cluster process at a time? breaks over 700 for me

@pimlie
Copy link
Member Author

pimlie commented Jan 28, 2020

@lxsedov Are you on Windows? The limit talked about in this issue is caused by the nuxt.config that is passed from the master to worker. If your nuxt.config is big then you could experience this issue. The solution is to use the beforeWorkers hook to remove properties from your nuxt.config that the workers dont need. See the docs

@lxsedov
Copy link

lxsedov commented Jan 29, 2020

@pimlie on Windows it dies with 700 URLs, on Ubuntu after 5000. Is there a way to bypass the limitation of env var size? beforeWorkers doesn't really help when you need to use nuxt-generate for large amount of dynamic URLs.

@pimlie
Copy link
Member Author

pimlie commented Jan 29, 2020

@lxsedov Are you listing 5000 urls directly in your nuxt.config's generate.routes? If so, you can remove that property in beforeWorkers, the workers dont need that. The master needs it and uses it to distribute smaller route chunks to workers.
But really, give more information about what you are trying to do because what you are saying doesnt make that much sense to me so now I have to guess what you are trying to do

@lxsedov
Copy link

lxsedov commented Feb 21, 2020

basically i want to generate 2-3M pages based on dynamic routes; removing routes in beforeWorkers helped but now I get 'No routes so not starting workers' passing 125000 routes

@pimlie
Copy link
Member Author

pimlie commented Feb 23, 2020

@lxsedov Could you please share your full nuxt config? If thats not possible, at least the generate part?

@lxsedov
Copy link

lxsedov commented Feb 24, 2020

https://github.com/lxsedov/test/blob/master/nuxt-config.js; tried with completely fresh project no modules no plugins, passing 150k dynamic routes it fails with 'No routes so not starting workers'; win10 node10.16.0

@pimlie
Copy link
Member Author

pimlie commented Feb 24, 2020

Maybe try to clone the options first? You are probably now deleting the reference on the options in the master too

@lxsedov
Copy link

lxsedov commented Feb 24, 2020

It exits with 'No routes...' even before getting to 'beforeWorkers'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants