NUXT_B5033

A schema was assigned to the runtime config directly.

B5033

A value in nuxt.options.runtimeConfig is a schema. Nuxt replaces schemas with their default values when the configuration is loaded, and when a module calls updateRuntimeConfig(). A schema assigned to nuxt.options.runtimeConfig directly is never replaced, so modules that read it would receive the schema itself rather than a value.

Resolution

In a module, pass the schema to updateRuntimeConfig():

module.ts
import { defineNuxtModule, updateRuntimeConfig } from '@nuxt/kit'
import { z } from 'zod'

export default defineNuxtModule({
  setup (_options, nuxt) {
    nuxt.options.runtimeConfig.myModule = z.object({ apiKey: z.string() }) // [!code --]
    updateRuntimeConfig({ myModule: z.object({ apiKey: z.string() }) }) // [!code ++]
  },
})

If the module is not your own, report it to the module author.

Was this helpful?