useRuntimeConfig
does not inherits env variables without passing env
param in cloudflare workers
#2054
Labels
useRuntimeConfig
does not inherits env variables without passing env
param in cloudflare workers
#2054
Ref: nuxt/nuxt#25047
In the cloudflare workers runtime, the
useRuntimeConfig
utility without passing explicit(event)
parameter fallsback to the ambient context's value which because of cf limitation of env passed to first request, is not extended from env. (src)Ideally
event
context should default touseEvent()
however ironically CF is one of the only presets that does not have LocalAsyncStorage support out of the box.To make DX better and consistent for CF users, we can reevaluate
_sharedRuntimeConfig
value after first request to make sureuseRuntimeConfig()
will be upgraded at least once.Other alternative would be to disable caching for
_sharedRuntimeConfig
value at all. This has benefit of having synchronized runtime config even when running in ambient context but downside of less performance. (I will probably do this as is more straight forward and covering)The text was updated successfully, but these errors were encountered: