[GH-ISSUE #7529] chore[oauth-provider]: tests failing #19465

Closed
opened 2026-04-15 18:35:23 -05:00 by GiteaMirror · 8 comments
Owner

Originally created by @dvanmali on GitHub (Jan 21, 2026).
Original GitHub issue: https://github.com/better-auth/better-auth/issues/7529

Originally assigned to: @himself65 on GitHub.

To Reproduce

Current canary branch failing tests.

Run pnpm test inside /packages/oauth-provider.

 Test Files  3 failed | 9 passed (12)
      Tests  26 failed | 115 passed (141)
     Errors  22 errors

Current vs. Expected behavior

 Test Files  0 failed | 12 passed (12)
      Tests  0 failed | 141 passed (141)
     Errors  0 errors

What version of Better Auth are you using?

canary

Originally created by @dvanmali on GitHub (Jan 21, 2026). Original GitHub issue: https://github.com/better-auth/better-auth/issues/7529 Originally assigned to: @himself65 on GitHub. ### To Reproduce Current `canary` branch failing tests. Run `pnpm test` inside `/packages/oauth-provider`. ```bash Test Files 3 failed | 9 passed (12) Tests 26 failed | 115 passed (141) Errors 22 errors ``` ### Current vs. Expected behavior ```bash Test Files 0 failed | 12 passed (12) Tests 0 failed | 141 passed (141) Errors 0 errors ``` ### What version of Better Auth are you using? canary
GiteaMirror added the lockedbug labels 2026-04-15 18:35:23 -05:00
Author
Owner

@better-auth-agent[bot] commented on GitHub (Jan 21, 2026):

It looks like your tests are failing on the canary branch of the oauth-provider package. There has been a reported issue with tests in the same area within this branch, which resulted in both errors and failed tests. You might find it helpful to look at similar issues that have been addressed previously, like ensuring that your test environment is correctly set up and dependencies are properly updated, which might be causing mismatches during the tests [1].

Here are some steps you can consider for troubleshooting:

  1. Make sure that all prerequisites and dependencies for running tests are installed correctly.
  2. Run pnpm test again and check for any specific error messages that can guide you on what might be wrong.
  3. Look into the recent changes in the canary branch for any alterations that might have affected the tests.

If you continue facing issues, you may want to tag @bekacru or @ping__ so they can provide additional insights on your specific problem.

What specific error messages are you seeing when you run the tests?

If you need more help, tag @better-auth-agent in a comment so I can respond.

DiagramDiscordGitHub

Diagram Join Star

<!-- gh-comment-id:3780353413 --> @better-auth-agent[bot] commented on GitHub (Jan 21, 2026): It looks like your tests are failing on the `canary` branch of the `oauth-provider` package. There has been a reported issue with tests in the same area within this branch, which resulted in both errors and failed tests. You might find it helpful to look at similar issues that have been addressed previously, like ensuring that your test environment is correctly set up and dependencies are properly updated, which might be causing mismatches during the tests [[1]](https://github.com/better-auth/better-auth/issues/4150). Here are some steps you can consider for troubleshooting: 1. Make sure that all prerequisites and dependencies for running tests are installed correctly. 2. Run `pnpm test` again and check for any specific error messages that can guide you on what might be wrong. 3. Look into the recent changes in the `canary` branch for any alterations that might have affected the tests. If you continue facing issues, you may want to tag @bekacru or @ping__ so they can provide additional insights on your specific problem. What specific error messages are you seeing when you run the tests? _If you need more help, tag @better-auth-agent in a comment so I can respond._ <!-- bot:webhook reply v1 --> [Diagram](https://repodiagrams.s3.eu-north-1.amazonaws.com/better-auth_ultra_detailed_interactive.html) • [Discord](https://discord.gg/better-auth) • [GitHub](https://github.com/better-auth/better-auth) [![Diagram](https://img.shields.io/badge/Diagram-2b3137?style=flat-square)](https://repodiagrams.s3.eu-north-1.amazonaws.com/better-auth_ultra_detailed_interactive.html) [![Join](https://img.shields.io/badge/join-5865F2?logo=discord&logoColor=white&style=flat-square)](https://discord.gg/better-auth) [![Star](https://img.shields.io/badge/star-181717?logo=github&logoColor=white&style=flat-square)](https://github.com/better-auth/better-auth)
Author
Owner

@dosubot[bot] commented on GitHub (Jan 21, 2026):

Recent PRs have fixed several known test failures in /packages/oauth-provider on canary, including stricter plugin checks (the jwt plugin is now required unless disableJwtPlugin is set), improved error handling, and safer metadata parsing [#6996, #7225, #7232]. However, the test suite spins up local HTTP servers on fixed ports and mutates shared globals, which can cause race conditions and port conflicts when tests run in parallel (the default for Vitest), leading to errors and failures.

To troubleshoot:

  1. Make sure all dependencies are up to date (pnpm install).
  2. Try running tests serially (e.g., vitest --runInBand or vitest --sequence.shuffle false), since parallel runs can cause port conflicts and shared state issues.
  3. Double-check that your test setup includes both the oauthProvider and jwt plugins unless you explicitly set disableJwtPlugin: true.
  4. Clean any local build artifacts and ensure no local modifications are interfering.

If failures persist, please share specific error messages or stack traces from the failing tests to help narrow down the root cause. If you’re still seeing issues after these steps, try running in a clean environment to rule out local config problems.

To reply, just mention @dosu.


How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other

Chat with Dosu Open in Cursor Join Discord Share on X

<!-- gh-comment-id:3780406679 --> @dosubot[bot] commented on GitHub (Jan 21, 2026): <!-- Answer --> Recent PRs have fixed several known test failures in `/packages/oauth-provider` on canary, including stricter plugin checks (the `jwt` plugin is now required unless `disableJwtPlugin` is set), improved error handling, and safer metadata parsing [[#6996](https://github.com/better-auth/better-auth/pull/6996), [#7225](https://github.com/better-auth/better-auth/pull/7225), [#7232](https://github.com/better-auth/better-auth/pull/7232)]. However, the test suite spins up local HTTP servers on fixed ports and mutates shared globals, which can cause race conditions and port conflicts when tests run in parallel (the default for Vitest), leading to errors and failures. To troubleshoot: 1. Make sure all dependencies are up to date (`pnpm install`). 2. Try running tests serially (e.g., `vitest --runInBand` or `vitest --sequence.shuffle false`), since parallel runs can cause port conflicts and shared state issues. 3. Double-check that your test setup includes both the `oauthProvider` and `jwt` plugins unless you explicitly set `disableJwtPlugin: true`. 4. Clean any local build artifacts and ensure no local modifications are interfering. If failures persist, please share specific error messages or stack traces from the failing tests to help narrow down the root cause. If you’re still seeing issues after these steps, try running in a clean environment to rule out local config problems. <!-- Dosu Comment Footer --> *To reply, just mention [@dosu](https://go.dosu.dev/dosubot).* --- <sup>How did I do? [Good](https://app.dosu.dev/response-feedback/5fc7c381-0464-4b79-a4a9-d9a7e0bb17e3?feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback/5fc7c381-0464-4b79-a4a9-d9a7e0bb17e3?feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback/5fc7c381-0464-4b79-a4a9-d9a7e0bb17e3?feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback/5fc7c381-0464-4b79-a4a9-d9a7e0bb17e3?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/5fc7c381-0464-4b79-a4a9-d9a7e0bb17e3?feedback_type=hallucination) | [Report 🐛](https://app.dosu.dev/response-feedback/5fc7c381-0464-4b79-a4a9-d9a7e0bb17e3?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/5fc7c381-0464-4b79-a4a9-d9a7e0bb17e3?feedback_type=other)</sup> [![Chat with Dosu](https://dosu.dev/dosu-chat-badge.svg)](https://app.dosu.dev/cdda13d9-dd27-4d31-b09a-5d8bec92de21/ask?utm_source=github)&nbsp;[![Open in Cursor](https://dosu.dev/dosu-in-cursor.svg)](https://cursor.com/link/prompt?text=Recent%20PRs%20have%20fixed%20several%20known%20test%20failures%20in%20%60/packages/oauth-provider%60%20on%20canary%2C%20including%20stricter%20plugin%20checks%20%28the%20%60jwt%60%20plugin%20is%20now%20required%20unless%20%60disableJwtPlugin%60%20is%20set%29%2C%20improved%20error%20handling%2C%20and%20safer%20metadata%20parsing%20%5B%5B%236996%5D%28https%3A//github.com/better-auth/better-auth/pull/6996%29%2C%20%5B%237225%5D%28https%3A//github.com/better-auth/better-auth/pull/7225%29%2C%20%5B%237232%5D%28https%3A//github.com/better-auth/better-auth/pull/7232%29%5D.%20However%2C%20the%20test%20suite%20spins%20up%20local%20HTTP%20servers%20on%20fixed%20ports%20and%20mutates%20shared%20globals%2C%20which%20can%20cause%20race%20conditions%20and%20port%20conflicts%20when%20tests%20run%20in%20parallel%20%28the%20default%20for%20Vitest%29%2C%20leading%20to%20errors%20and%20failures.%0A%0ATo%20troubleshoot%3A%0A%0A1.%20Make%20sure%20all%20dependencies%20are%20up%20to%20date%20%28%60pnpm%20install%60%29.%0A2.%20Try%20running%20tests%20serially%20%28e.g.%2C%20%60vitest%20--runInBand%60%20or%20%60vitest%20--sequence.shuffle%20false%60%29%2C%20since%20parallel%20runs%20can%20cause%20port%20conflicts%20and%20shared%20state%20issues.%0A3.%20Double-check%20that%20your%20test%20setup%20includes%20both%20the%20%60oauthProvider%60%20and%20%60jwt%60%20plugins%20unless%20you%20explicitly%20set%20%60disableJwtPlugin%3A%20true%60.%0A4.%20Clean%20any%20local%20build%20artifacts%20and%20ensure%20no%20local%20modifications%20are%20interfering.%0A%0AIf%20failures%20persist%2C%20please%20share%20specific%20error%20messages%20or%20stack%20traces%20from%20the%20failing%20tests%20to%20help%20narrow%20down%20the%20root%20cause.%20If%20you%E2%80%99re%20still%20seeing%20issues%20after%20these%20steps%2C%20try%20running%20in%20a%20clean%20environment%20to%20rule%20out%20local%20config%20problems.)&nbsp;[![Join Discord](https://img.shields.io/badge/join-5865F2?logo=discord&logoColor=white&label=)](https://go.dosu.dev/discord-bot)&nbsp;[![Share on X](https://img.shields.io/badge/X-share-black)](https://twitter.com/intent/tweet?text=%40dosu_ai%20helped%20me%20solve%20this%20issue!&url=https%3A//github.com/better-auth/better-auth/issues/7529)
Author
Owner

@himself65 commented on GitHub (Jan 21, 2026):

Maybe a regression since 4b297168b8

<!-- gh-comment-id:3780682079 --> @himself65 commented on GitHub (Jan 21, 2026): Maybe a regression since https://github.com/better-auth/better-auth/commit/4b297168b8df43f40e3f58cca6e9b403e2b05626
Author
Owner

@himself65 commented on GitHub (Jan 21, 2026):

Oh, I see what is happening, we use coverage in CI but we don't have the script in packages.

<!-- gh-comment-id:3780691990 --> @himself65 commented on GitHub (Jan 21, 2026): Oh, I see what is happening, we use `coverage` in CI but we don't have the script in packages.
Author
Owner

@himself65 commented on GitHub (Jan 21, 2026):

From what I see from error log, this is from 3fc48fb4b6

We use node:sqlite and it cause migration issue

<!-- gh-comment-id:3780694157 --> @himself65 commented on GitHub (Jan 21, 2026): From what I see from error log, this is from https://github.com/better-auth/better-auth/commit/3fc48fb4b6d67921c0600d2c61e11b2ff365dc0d We use node:sqlite and it cause migration issue
Author
Owner

@himself65 commented on GitHub (Jan 21, 2026):

window !== undefined somehow

<!-- gh-comment-id:3780748580 --> @himself65 commented on GitHub (Jan 21, 2026): `window !== undefined` somehow
Author
Owner

@dvanmali commented on GitHub (Jan 21, 2026):

The tests that rely on window can be fixed by sending oauth_query directly to the consent/continue/etc endpoints directly.

But also vi.stubGlobal should also work 👍

<!-- gh-comment-id:3780901615 --> @dvanmali commented on GitHub (Jan 21, 2026): The tests that rely on window can be fixed by sending `oauth_query` directly to the consent/continue/etc endpoints directly. But also `vi.stubGlobal` should also work 👍
Author
Owner

@himself65 commented on GitHub (Jan 21, 2026):

This is a regression for a period, but I think this won'tbe related to 1.4 since we don't have APIError in the core package

<!-- gh-comment-id:3781043057 --> @himself65 commented on GitHub (Jan 21, 2026): This is a regression for a period, but I think this won'tbe related to 1.4 since we don't have `APIError` in the core package
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#19465