Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

500 error: defineAppConfig is not defined #680

Closed
zoey-kaiser opened this issue Nov 18, 2022 · 8 comments
Closed

500 error: defineAppConfig is not defined #680

zoey-kaiser opened this issue Nov 18, 2022 · 8 comments
Assignees

Comments

@zoey-kaiser
Copy link

zoey-kaiser commented Nov 18, 2022

Hello! I recently began working on a documentation page for https://github.com/sidebase/nuxt-auth. I am really happy with the DX, feature set and design of docus. However I sadly ran into an issue to which I could not find the solution yet.

I began coding my docs page in a seperate private repository. However when it came time to add it to the official module repository I received an error saying defineAppConfig is not defined.

I copied the project folder one to one and it works in its own repo. Can this have something to do with our module setup?

Reproduction Link:
https://github.com/sidebase/nuxt-auth/tree/add-docs
sidebase/nuxt-auth#43

Environment:

- Operating System: `Darwin`
- Node Version:     `v16.17.0`
- Nuxt Version:     `3.0.0-rc.12`
- Nitro Version:    `0.6.0`
- Package Manager:  `npm@8.15.0`
- Builder:          `vite`
- User Config:      `extends`
- Runtime Modules:  `-`
- Build Modules:    `-`

Error:

Nuxi 3.0.0                                                                                                                                                                                                                13:23:46
Nuxt 3.0.0 with Nitro 1.0.0                                                                                                                                                                                               13:23:46
✔ Using Nuxt Typography v0.0.13                                                                                                                                                                                           13:23:47
                                                                                                                                                                                                                          13:23:47
  > Local:    http://localhost:3000/ 
  > Network:  http://192.168.0.232:3000/
  > Network:  http://[2a02:1810:cc2e:a300:187d:17d2:d8f8:4249]:3000/
  > Network:  http://[2a02:1810:cc2e:a300:6ced:aa4e:ffd9:543e]:3000/

✔ Nitro built in 1294 ms                                                                                                                                                                                            nitro 13:23:55
ℹ Vite client warmed up in 3333ms                                                                                                                                                                                         13:23:56
[nuxt] [request error] [unhandled] [500] defineAppConfig is not defined                                                                                                                                                   13:24:00
  at ./app.config.ts:1:1                                                                                                                                                                                                  13:23:46
  at ViteNodeRunner.directRequest (./node_modules/vite-node/dist/client.mjs:270:11)  
  at processTicksAndRejections (node:internal/process/task_queues:96:5)  
  at async ViteNodeRunner.cachedRequest (./node_modules/vite-node/dist/client.mjs:146:12)  
  at async request (./node_modules/vite-node/dist/client.mjs:169:16)  
  at async ./.nuxt/app.config.mjs:7:31  
  at async ViteNodeRunner.directRequest (./node_modules/vite-node/dist/client.mjs:270:5)  
  at async ViteNodeRunner.cachedRequest (./node_modules/vite-node/dist/client.mjs:146:12)  
  at async request (./node_modules/vite-node/dist/client.mjs:169:16)  
  at async ./node_modules/nuxt/dist/app/config.mjs:5:31
[nuxt] [request error] [unhandled] [500] defineAppConfig is not defined                                                                                                                                                   13:24:00
  at ./app.config.ts:1:1  
  at ViteNodeRunner.directRequest (./node_modules/vite-node/dist/client.mjs:270:11)  
  at processTicksAndRejections (node:internal/process/task_queues:96:5)  
  at async ViteNodeRunner.cachedRequest (./node_modules/vite-node/dist/client.mjs:146:12)  
  at async request (./node_modules/vite-node/dist/client.mjs:169:16)  
  at async ./.nuxt/app.config.mjs:7:31  
  at async ViteNodeRunner.directRequest (./node_modules/vite-node/dist/client.mjs:270:5)  
  at async ViteNodeRunner.cachedRequest (./node_modules/vite-node/dist/client.mjs:146:12)  
  at async request (./node_modules/vite-node/dist/client.mjs:169:16)  
  at async ./node_modules/nuxt/dist/app/config.mjs:5:31

Thank you in advance for any pointers or help ❤️

@zoey-kaiser
Copy link
Author

Manually adding an import for defineAppConfig results in the following error:

Code:

// file ~/app.config.ts
import { defineAppConfig } from '#app'

export default defineAppConfig({
    docus: {
        title: 'sidebase',
        description: 'The official sidebase documentation.',
        url: 'https://sidebase.io',
        image: '/social-card-preview.png',
        socials: {
            twitter: '@sidebase_io',
            github: 'sidebase',
        },
        header: {
            title: 'sidebase docs',
            logo: true,
            showLinkIcon: true,
            exclude: ['/nuxt-session', '/nuxt-parse', '/guide'],
        },
        aside: {
            level: 1,
            exclude: ['/guide', '/nuxt-session', '/nuxt-parse']
        },
    }
})

Error:

Nuxi 3.0.0                                                                                                                                                                                                                13:36:54
Nuxt 3.0.0 with Nitro 1.0.0                                                                                                                                                                                               13:36:54
✔ Using Nuxt Typography v0.0.13                                                                                                                                                                                           13:36:54
                                                                                                                                                                                                                          13:36:54
  > Local:    http://localhost:3000/ 
  > Network:  http://192.168.0.232:3000/
  > Network:  http://[2a02:1810:cc2e:a300:187d:17d2:d8f8:4249]:3000/
  > Network:  http://[2a02:1810:cc2e:a300:6ced:aa4e:ffd9:543e]:3000/

ℹ Vite client warmed up in 2692ms                                                                                                                                                                                         13:37:04
✔ Nitro built in 1389 ms                                                                                                                                                                                            nitro 13:37:05
[nuxt] [request error] [unhandled] [500] defineAppConfig is not defined                                                                                                                                                   13:37:05
  at ./node_modules/@nuxt-themes/docus/app.config.ts:1:1                                                                                                                                                                  13:36:54
  at ViteNodeRunner.directRequest (./node_modules/vite-node/dist/client.mjs:270:11)  
  at processTicksAndRejections (node:internal/process/task_queues:96:5)  
  at async ViteNodeRunner.cachedRequest (./node_modules/vite-node/dist/client.mjs:146:12)  
  at async request (./node_modules/vite-node/dist/client.mjs:169:16)  
  at async ./.nuxt/app.config.mjs:9:31  
  at async ViteNodeRunner.directRequest (./node_modules/vite-node/dist/client.mjs:270:5)  
  at async ViteNodeRunner.cachedRequest (./node_modules/vite-node/dist/client.mjs:146:12)  
  at async request (./node_modules/vite-node/dist/client.mjs:169:16)  
  at async ./node_modules/nuxt/dist/app/config.mjs:5:31
[nuxt] [request error] [unhandled] [500] defineAppConfig is not defined                                                                                                                                                   13:37:05
  at ./node_modules/@nuxt-themes/docus/app.config.ts:1:1  
  at ViteNodeRunner.directRequest (./node_modules/vite-node/dist/client.mjs:270:11)  
  at processTicksAndRejections (node:internal/process/task_queues:96:5)  
  at async ViteNodeRunner.cachedRequest (./node_modules/vite-node/dist/client.mjs:146:12)  
  at async request (./node_modules/vite-node/dist/client.mjs:169:16)  
  at async ./.nuxt/app.config.mjs:9:31  
  at async ViteNodeRunner.directRequest (./node_modules/vite-node/dist/client.mjs:270:5)  
  at async ViteNodeRunner.cachedRequest (./node_modules/vite-node/dist/client.mjs:146:12)  
  at async request (./node_modules/vite-node/dist/client.mjs:169:16)  
  at async ./node_modules/nuxt/dist/app/config.mjs:5:31
[nuxt] [request error] [unhandled] [500] defineAppConfig is not defined                                                                                                                                                   13:37:05
  at ./node_modules/@nuxt-themes/docus/app.config.ts:1:1  
  at ViteNodeRunner.directRequest (./node_modules/vite-node/dist/client.mjs:270:11)  
  at processTicksAndRejections (node:internal/process/task_queues:96:5)  
  at async ViteNodeRunner.cachedRequest (./node_modules/vite-node/dist/client.mjs:146:12)  
  at async request (./node_modules/vite-node/dist/client.mjs:169:16)  
  at async ./.nuxt/app.config.mjs:9:31  
  at async ViteNodeRunner.directRequest (./node_modules/vite-node/dist/client.mjs:270:5)  
  at async ViteNodeRunner.cachedRequest (./node_modules/vite-node/dist/client.mjs:146:12)  
  at async request (./node_modules/vite-node/dist/client.mjs:169:16)  
  at async ./node_modules/nuxt/dist/app/config.mjs:5:31
[nuxt] [request error] [unhandled] [500] defineAppConfig is not defined                                                                                                                                                   13:37:05
  at ./node_modules/@nuxt-themes/docus/app.config.ts:1:1  
  at ViteNodeRunner.directRequest (./node_modules/vite-node/dist/client.mjs:270:11)  
  at processTicksAndRejections (node:internal/process/task_queues:96:5)  
  at async ViteNodeRunner.cachedRequest (./node_modules/vite-node/dist/client.mjs:146:12)  
  at async request (./node_modules/vite-node/dist/client.mjs:169:16)  
  at async ./.nuxt/app.config.mjs:9:31  
  at async ViteNodeRunner.directRequest (./node_modules/vite-node/dist/client.mjs:270:5)  
  at async ViteNodeRunner.cachedRequest (./node_modules/vite-node/dist/client.mjs:146:12)  
  at async request (./node_modules/vite-node/dist/client.mjs:169:16)  
  at async ./node_modules/nuxt/dist/app/config.mjs:5:31

Copy link
Contributor

atinux commented Nov 18, 2022

Could you also update your nuxt dependency at the root of your project to 3.0.0 too?

@zoey-kaiser
Copy link
Author

Could you also update your nuxt dependency at the root of your project to 3.0.0 too?

We are sadly having issues upgrading nuxt-auth from RC12 to RC13 (and also the stable release).
@BracketJohn already opened an issue for this here: nuxt/nuxt#15455

I just attempted to bump the dependencies, however I sadly got the same type error. Do you have any ideas why we cannot upgrade?

@zoey-kaiser
Copy link
Author

Could you also update your nuxt dependency at the root of your project to 3.0.0 too?

We have updated nuxt-auth to run on Nuxt 3.0.0. Sadly we are still having the same issue. The docus project in /docs was generated via the command on the website.

https://github.com/sidebase/nuxt-auth/tree/add-docs-workflows

Copy link
Contributor

atinux commented Nov 26, 2022

If you try on a fresh repo it works?

@Tahul Tahul self-assigned this Nov 27, 2022
@Tahul
Copy link
Contributor

Tahul commented Nov 27, 2022

@zoey-kaiser ; I was waiting on fixing nuxt/framework#684 to dig on this one.

Does the fix coming from it helped there?

@Tahul Tahul changed the title 500 error: defineAppConfig is not definied 500 error: defineAppConfig is not defined Nov 27, 2022
@atinux atinux closed this as completed Dec 1, 2022
@zoey-kaiser
Copy link
Author

Hi! Sorry it took me a few more days to answer, I have been pretty swamped.

@zoey-kaiser ; I was waiting on fixing nuxt/framework#684 to dig on this one.

Does the fix coming from it helped there?

Sadly it does not. I attempted upgrading the project to Docus v1.1.1 (see here) and I still get the error:

Nuxi 3.0.0                                                                                                                                                                                                         11:32:48
Nuxt 3.0.0 with Nitro 1.0.0                                                                                                                                                                                        11:32:48
✔ Using Docus v1.1.1                                                                                                                                                                                               11:32:49
✔ Using Nuxt Typography v0.1.3                                                                                                                                                                                     11:32:49
                                                                                                                                                                                                                   11:32:49
  > Local:    http://localhost:3000/ 
  > Network:  http://192.168.0.218:3000/
  > Network:  http://[2a02:1810:cc2e:a300:187d:17d2:d8f8:4249]:3000/
  > Network:  http://[2a02:1810:cc2e:a300:993d:63df:dc87:7d13]:3000/

✔ Nitro built in 1194 ms                                                                                                                                                                                     nitro 11:32:53
ℹ Vite client warmed up in 3201ms                                                                                                                                                                                  11:32:53
[nuxt] [request error] [unhandled] [500] defineAppConfig is not defined                                                                                                                                            11:32:54
  at ./app.config.ts:1:1  
  at ViteNodeRunner.directRequest (./node_modules/vite-node/dist/client.mjs:272:11)  
  at processTicksAndRejections (node:internal/process/task_queues:96:5)
[nitro] [dev] [unhandledRejection] ReferenceError: defineAppConfig is not defined                                                                                                                                  11:32:54
    at /Users/zoey/Documents/Development/SideStream/sidebase/nuxt-auth/docs/app.config.ts:1:1
    at ViteNodeRunner.directRequest (file:///Users/zoey/Documents/Development/SideStream/sidebase/nuxt-auth/docs/node_modules/vite-node/dist/client.mjs:272:11)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
[nitro] [dev] [unhandledRejection] ReferenceError: defineAppConfig is not defined                                                                                                                                  11:32:54
    at /Users/zoey/Documents/Development/SideStream/sidebase/nuxt-auth/docs/app.config.ts:1:1
    at ViteNodeRunner.directRequest (file:///Users/zoey/Documents/Development/SideStream/sidebase/nuxt-auth/docs/node_modules/vite-node/dist/client.mjs:272:11)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
[nitro] [dev] [unhandledRejection] ReferenceError: defineAppConfig is not defined                                                                                                                                  11:32:54
    at /Users/zoey/Documents/Development/SideStream/sidebase/nuxt-auth/docs/app.config.ts:1:1
    at ViteNodeRunner.directRequest (file:///Users/zoey/Documents/Development/SideStream/sidebase/nuxt-auth/docs/node_modules/vite-node/dist/client.mjs:272:11)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
[nitro] [dev] [unhandledRejection] ReferenceError: defineAppConfig is not defined                                                                                                                                  11:32:54
    at /Users/zoey/Documents/Development/SideStream/sidebase/nuxt-auth/docs/app.config.ts:1:1
    at ViteNodeRunner.directRequest (file:///Users/zoey/Documents/Development/SideStream/sidebase/nuxt-auth/docs/node_modules/vite-node/dist/client.mjs:272:11)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
[nitro] [dev] [unhandledRejection] ReferenceError: defineAppConfig is not defined                                                                                                                                  11:32:54
    at /Users/zoey/Documents/Development/SideStream/sidebase/nuxt-auth/docs/app.config.ts:1:1
    at ViteNodeRunner.directRequest (file:///Users/zoey/Documents/Development/SideStream/sidebase/nuxt-auth/docs/node_modules/vite-node/dist/client.mjs:272:11)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
[nuxt] [request error] [unhandled] [500] defineAppConfig is not defined                                                                                                                                            11:32:54
  at ./app.config.ts:1:1  
  at ViteNodeRunner.directRequest (./node_modules/vite-node/dist/client.mjs:272:11)  
  at processTicksAndRejections (node:internal/process/task_queues:96:5)
[nuxt] [request error] [unhandled] [500] defineAppConfig is not defined                                                                                                                                            11:32:54
  at ./app.config.ts:1:1  
  at ViteNodeRunner.directRequest (./node_modules/vite-node/dist/client.mjs:272:11)  
  at processTicksAndRejections (node:internal/process/task_queues:96:5)
[nuxt] [request error] [unhandled] [500] defineAppConfig is not defined                                                                                                                                            11:32:54
  at ./app.config.ts:1:1  
  at ViteNodeRunner.directRequest (./node_modules/vite-node/dist/client.mjs:272:11)  
  at processTicksAndRejections (node:internal/process/task_queues:96:5)

If you try on a fresh repo it works?

Using it in an empty folder / new npm project does work! I assume it has to do with some other package in the root conflicting with docus. These are our dependencies:

  "dependencies": {
    "@nuxt/kit": "^3.0.0-rc.12",
    "defu": "^6.1.0",
    "next-auth": "^4.14.0",
    "requrl": "^3.0.2",
    "ufo": "^1.0.0"
  },
  "devDependencies": {
    "@nuxt/module-builder": "^0.2.1",
    "@nuxt/schema": "^3.0.0",
    "@nuxtjs/eslint-config-typescript": "^12.0.0",
    "eslint": "^8.25.0",
    "nuxt": "^3.0.0",
    "ofetch": "^1.0.0"
  }

Thank you in advance!

@pascal-klesse
Copy link

Same error on my new nuxt module. Some updates about this issue? :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants