nuxt-auth icon indicating copy to clipboard operation
nuxt-auth copied to clipboard

Object literal may only specify known properties, and 'origin' does not exist in type 'Partial<ModuleOptions>'

Open Timothy16 opened this issue 1 year ago • 3 comments

Environment

Type '{ origin: string; basePath: string; enableGlobalAppMiddleware: true; }' is not assignable to type 'Partial<ModuleOptions>'. Object literal may only specify known properties, and 'origin' does not exist in type 'Partial<ModuleOptions>'.ts(2322) schema.d.ts(4, 5): The expected type comes from property 'auth' which is declared here on type 'InputConfig<NuxtConfig, ConfigLayerMeta>'

Timothy16 avatar Jun 27 '23 13:06 Timothy16

Hi @Timothy16,

Please provide more context to your issues then just the error message. As this issue is a little bit older, I will close it now. If the issue still persists please open a new issue and provide the needed context, so I can begin a full investigation!

zoey-kaiser avatar Nov 06 '23 13:11 zoey-kaiser

I came across this error too. It happens in nuxt.config.ts when using an incorrect config (origin) for this module.

Because I didn't set the AUTH_ORIGIN variable, I received a message to access this documentation: https://sidebase.io/nuxt-auth/v0.6/resources/errors#auth_no_origin

But the documentation is incorrect:

nuxt-auth tries to find the origin of your application in the following order:
Use the AUTH_ORIGIN environment variable if it is set,
- Use the auth: { origin: 'https://your-cool-origin.com' } config-value from the nuxt.config.ts if it is set,
+ Use the auth: { baseURL: 'https://your-cool-origin.com' } config-value from the nuxt.config.ts if it is set,
Development only: Determine the origin automatically from the incoming HTTP request

luizzappa avatar Nov 19 '23 23:11 luizzappa

Hi @luizzappa,

We sadly forgot to update this in the docs. I will update them ASAP! Thanks for pointing it out.

Starting from 0.6.0 we removed this origin from the nuxt config. It should be set as the AUTH_ORIGIN environment variable. This change we done, to streamline where the origin it set, as there was some confusion on this before. As the origin is heavily dependent on the deployment location, it is better to set this as an environment variable.

zoey-kaiser avatar Nov 20 '23 10:11 zoey-kaiser