@clerk/nuxt: calling updateRuntimeConfig() in setup prints NUXT_B8003 "Nitro is not initialized yet" on Nuxt 4.5
@wobsoriano đang làm issue này rồi.
Từ ngày 23/9/2026.
Đánh giá
Issue này chưa được đánh giá.
Mô tả
Preliminary Checks
- I have reviewed the documentation: https://clerk.com/docs
- I have searched for existing issues: https://github.com/clerk/javascript/issues
- I have not already reached out to Clerk support via email or Discord
- This issue is not a question, general help request, or anything other than a bug report directly related to Clerk
Reproduction
Inline below: three files, no Clerk account or key needed. The warning appears at build time.
Publishable key
N/A. The warning appears with no key configured.
Description
On Nuxt 4.5, every nuxt build and nuxt dev that loads @clerk/nuxt prints:
WARN [NUXT_B8003] Nitro is not initialized yet: useNitro() was called before the ready hook ran.
╰▶ fix: Move the useNitro() call inside a hook that runs after initialization, such as nuxt.hook('ready', () => { ... }).
Nothing is broken, because the runtime config is still applied. But the warning shows up in every consumer's build output, and it tells them to fix something that isn't in their code.
Cause
packages/nuxt/src/module.ts calls updateRuntimeConfig() from @nuxt/kit inside setup(). Nitro hasn't been created at that point. The kit helper does two things:
// packages/kit/src/runtime-config.ts (nuxt/nuxt main)
export function updateRuntimeConfig (runtimeConfig) {
const nuxt = useNuxt()
Object.assign(nuxt.options.nitro.runtimeConfig, defu(runtimeConfig, nuxt.options.nitro.runtimeConfig))
try {
return useNitro().updateConfig({ runtimeConfig })
} catch {
// Nitro is not yet initialised - we can safely ignore this error
}
}
The first line does the real work at setup time. The useNitro() call is for updating a Nitro instance that's already running, and it throws here. The catch swallows the error, but since the diagnostics rework (Nuxt 4.5), building kitDiagnostics.NUXT_B8003() reports the warning to the console before it's thrown. So the try/catch no longer keeps it quiet.
Steps to reproduce:
-
Create a project with these files:
package.json{ "private": true, "type": "module", "scripts": { "build": "nuxt build" }, "dependencies": { "nuxt": "4.5.2", "vue": "latest", "@clerk/nuxt": "3.1.3" } }nuxt.config.tsexport default defineNuxtConfig({ compatibilityDate: '2025-07-15', modules: ['@clerk/nuxt'] })app/app.vue<template><div>hi</div></template> -
pnpm install && pnpm build -
The
NUXT_B8003warning prints. Remove@clerk/nuxtfrommodulesand it goes away.
Expected behavior:
Loading @clerk/nuxt produces no warning.
Actual behavior:
[NUXT_B8003] is printed on every build and dev start.
Possible solutions
-
Merge into the options directly in
setup()(Clerk-side, smallest change). This is the only part ofupdateRuntimeConfigthat has any effect during setup:import { defu } from 'defu' setup(options, nuxt) { const runtimeConfig = { public: { clerk: { /* …unchanged… */ } }, clerk: { /* …unchanged… */ } } Object.assign(nuxt.options.nitro.runtimeConfig, defu(runtimeConfig, nuxt.options.nitro.runtimeConfig)) // … }I patched this into the published 3.1.3
dist/module.jsin the repro above. The warning is gone, and the runtime config Nitro serializes (public.clerk.*andclerk.*, still overridable viaNUXT_PUBLIC_CLERK_*/NUXT_CLERK_*) is byte-for-byte the same as before.Merging into
nuxt.options.runtimeConfigwithdefuis another option. It's the documented module pattern, but it has different precedence from what the kit helper does today. -
Fix it in
@nuxt/kit.updateRuntimeConfigcould checktryUseNitro(), which already exists inpackages/kit/src/nitro.ts, instead of catching auseNitro()throw. That would fix it for every module that calls the helper during setup. It's worth raising with Nuxt either way, but option 1 is under Clerk's control and works on Nuxt 4.5.x as released. -
Defer the call to a hook, as the warning suggests (for example
nuxt.hook('ready', …)). I wouldn't recommend this, becausesetup()is exactly when the keys need to exist so that env overrides are picked up. Option 1 keeps the timing as it is now.
Environment
System:
OS: macOS 26.6.2
CPU: (10) arm64 Apple M4
Binaries:
Node: 26.8.2
npm: 11.19.1
pnpm: 12.4.1
npmPackages:
@clerk/nuxt: 3.1.3 => 3.1.3
nuxt: 4.5.2 => 4.5.2
vue: latest => 3.5.43
Also seen with @clerk/nuxt 2.6.22.
- Ngôn ngữ chính
- TypeScript
- Star
- 1.8k
- Fork
- 472
- Merge trung bình
- 2 ngày 12 giờ
- Pull request đã merge (30 ngày)
- 222
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của clerk/javascript
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
clerk/javascript#9611 · 1 bình luận ·
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 64/100
clerk/javascript#9775 · 1 bình luận ·
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 48/100
clerk/javascript#9770 · 3 bình luận ·
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 68/100
clerk/javascript#9667 · 1 bình luận ·
-
needs-triage
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 58/100
clerk/javascript#9478 · 2 bình luận ·
Tất cả issue của clerk/javascript
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
mksglu/context-mode#1200 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
jaegertracing/jaeger-ui#4506 ·
-
area:desktop area:ui bug platform:macos
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
anthropics/claude-code#96687 ·
-
good first issue
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 95/100
AOSSIE-Org/DebateAI#582 · 2 bình luận ·