Repository navigation
fix: read Nitro's runtime config in the server useSafeRuntimeConfig - #48
Conversation
The shared composable imported useRuntimeConfig from #imports. On Nuxt 5 that import makes Nuxt apply its Nitro v2 compatibility layer to the module (NUXT_B9003). The server import now has its own file that reads #safe-runtime-config/nitro-runtime-config, the same alias the validation plugin uses.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Codex Review Summary: ❌ FailedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
commit: |
There was a problem hiding this comment.
Important
The automatic server import is fixed, but the documented explicit #imports server path still selects the compatibility-triggering implementation.
Reviewed changes in 4d2734d: the Nuxt app and Nitro server now register separate useSafeRuntimeConfig sources, with shared validation-state reading extracted into one helper.
- Server auto-import split — Nitro auto-imports now read runtime config through
#safe-runtime-config/nitro-runtime-config, while app imports retain Nuxt's#importsimplementation. - Shared validated read — Both implementations call
readValidatedRuntimeConfigto preserve first-read validation and transformed output. - Package and behavior coverage — The new server runtime builds into
dist, generated Nuxt 4 Nitro imports select it, and the affected validation, coercion, transform, typing, and Cloudflare tests pass.
gpt-5.6-sol | 𝕏
Latest result Pull request merged. Final answersSession Pull request merged. Pushed 7262450 fixing Pullfrog P1 explicit server import contract with #safe-runtime-config/server and updated documentation; thread resolved. pnpm dev:prepare, focused Nuxt 4 typing/coercion tests (6 passed), changed-source ESLint, and git diff --check passed. Dependency refresh succeeded, though checkDependencies still rejects the existing minimumReleaseAgeExcludePrune setting. Awaiting hosted CI. |
There was a problem hiding this comment.
✅ No new issues found. No P0 or P1 finding remains.
Reviewed changes since the prior Pullfrog review addressed the explicit server import contract without reintroducing Nuxt's Nitro v2 compatibility path.
- Added a server entry point — Registered
#safe-runtime-config/serveras an alias to the Nitro-specificuseSafeRuntimeConfigimplementation. - Narrowed the import contract — Documented
#importsfor app code and the new server alias for explicit imports in server code. - Covered explicit imports — Extended the typing and runtime-coercion fixtures to exercise the server alias with typed and event-scoped config.
gpt-5.6-sol | 𝕏

On the Nuxt 5 nightly, every build with this module warns
NUXT_B9003: Nuxt applies its Nitro v2 compatibility layer to the module because the serveruseSafeRuntimeConfigimports#imports. Nuxt 6 removes that layer.The app and the server shared one composable file, and
#importsis the app import. This PR gives the server import its own file, which readsuseRuntimeConfigfrom#safe-runtime-config/nitro-runtime-config, the alias the validation plugin already uses. On Nuxt 5, Nuxt rewrites that module to its own runtime config, so both read the same object. The app composable stays the same.I checked it against
nuxt-nightly@5.0.0-2611090045-6d7dd80with the packed module and an inline Valibot schema.mainwarnsNUXT_B9003and this branch doesn't. After the build,NUXT_PORT=8080 NUXT_PUBLIC_REPLAY_ENABLED=truereachuseSafeRuntimeConfig(event)as a number and a boolean, and the rendered page showstrue boolean.NUXT_DATABASE_URL=nopestops the server. On Nuxt 4,runtime-validator,validation(server typing throughvue-tsc),cloudflare-auto-import,runtime-transformandruntime-coercionpass. I didn't add a Nuxt 5 test, because the test fixtures pin Nuxt 4.5.