Nuxt worker init error #200

Closed
opened 2026-03-13 07:37:20 -05:00 by GiteaMirror · 4 comments
Owner

Originally created by @KazBrekker1 on GitHub (Nov 10, 2024).

Describe the bug
Adding the auth handler in the /api/auth/[...all].ts breaks the app with the following worker.

To Reproduce

  1. Setup nuxt with better-auth using postgres.
  2. Using bun as the package manager.

Screenshots
image

Desktop (please complete the following information):

  • OS: MacOs Sequoia
  • Browser Chrome & Brave

Additional context
As soon as I comment out the auth.handler line in the Endpoint, the dev run/build finishes correctly

Originally created by @KazBrekker1 on GitHub (Nov 10, 2024). **Describe the bug** Adding the auth handler in the /api/auth/[...all].ts breaks the app with the following worker. **To Reproduce** 1. Setup nuxt with better-auth using postgres. 2. Using bun as the package manager. **Screenshots** <img width="845" alt="image" src="https://github.com/user-attachments/assets/f582c883-c237-4249-a5c2-5ea666fe354a"> **Desktop (please complete the following information):** - OS: MacOs Sequoia - Browser Chrome & Brave **Additional context** As soon as I comment out the auth.handler line in the Endpoint, the dev run/build finishes correctly
Author
Owner

@Limerio commented on GitHub (Nov 17, 2024):

Have you try to follow the recommended approach? https://www.better-auth.com/docs/integrations/nuxt

@Limerio commented on GitHub (Nov 17, 2024): Have you try to follow the recommended approach? https://www.better-auth.com/docs/integrations/nuxt
Author
Owner

@KazBrekker1 commented on GitHub (Nov 17, 2024):

I tried the recommended approach with /server/api/[...auth].ts as well as the way the nuxt example does it, /server/api/auth/[...all].ts

both produce the same error.

Here is a stackblitz: https://stackblitz.com/~/github.com/KazBrekker1/nuxt-better-auth

@KazBrekker1 commented on GitHub (Nov 17, 2024): I tried the recommended approach with /server/api/[...auth].ts as well as the way the nuxt example does it, /server/api/auth/[...all].ts both produce the same error. Here is a stackblitz: https://stackblitz.com/~/github.com/KazBrekker1/nuxt-better-auth
Author
Owner

@KazBrekker1 commented on GitHub (Nov 23, 2024):

with the release of v1.0, any news regarding the nuxt integration?
please let me know if im doing something wrong in the repo i linked previously

@KazBrekker1 commented on GitHub (Nov 23, 2024): with the release of v1.0, any news regarding the nuxt integration? please let me know if im doing something wrong in the repo i linked previously
Author
Owner

@KazBrekker1 commented on GitHub (Dec 8, 2024):

The issue was how i imported the pg Pool
It was:
import { Pool } from "pg";
it should be:

import pkg from "pg";
const { Pool } =pkg
@KazBrekker1 commented on GitHub (Dec 8, 2024): The issue was how i imported the pg Pool It was: `import { Pool } from "pg";` it should be: ``` import pkg from "pg"; const { Pool } =pkg ```
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#200