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

Auth.js + SvelteKit crash: Unexpected AnyRequestContext tag #7029

Open
ttmx opened this issue Nov 10, 2023 · 4 comments
Open

Auth.js + SvelteKit crash: Unexpected AnyRequestContext tag #7029

ttmx opened this issue Nov 10, 2023 · 4 comments
Labels
crash An issue that could cause a crash

Comments

@ttmx
Copy link

ttmx commented Nov 10, 2023

What version of Bun is running?

1.0.11+f7f6233ea

What platform is your computer?

Linux 6.5.0-10-generic x86_64 x86_64

What steps can reproduce the bug?

Setup AuthJs with SvelteKit. My specific case is using the Google oauth provider and a Prisma adapter for the database.

Run bun run dev
Attempt to login, get crash.

What is the expected behavior?

Redirecting to the Google oauth login page.

What do you see instead?

11:20:56 AM [vite] hmr update /src/routes/(authed)/synthetic-data/+page.svelte, /src/app.css
107 |     const redirect = response.headers.get("Location");
108 |     if (request.headers.has("X-Auth-Return-Redirect") && redirect) {
109 |         response.headers.delete("Location");
110 |         response.headers.set("Content-Type", "application/json");
111 |         return new Response(JSON.stringify({ url: redirect }), {
112 |             status: internalResponse.status,
                                        ^
RangeError: The status provided (0) must be 101 or in the range of [200, 599]
      at /censored/project-root/node_modules/@auth/core/index.js:112:37

107 |     const redirect = response.headers.get("Location");
108 |     if (request.headers.has("X-Auth-Return-Redirect") && redirect) {
109 |         response.headers.delete("Location");
110 |         response.headers.set("Content-Type", "application/json");
111 |         return new Response(JSON.stringify({ url: redirect }), {
112 |             status: internalResponse.status,
                                        ^
RangeError: The status provided (0) must be 101 or in the range of [200, 599]
      at /censored/project-root/node_modules/@auth/core/index.js:112:37

107 |     const redirect = response.headers.get("Location");
108 |     if (request.headers.has("X-Auth-Return-Redirect") && redirect) {
109 |         response.headers.delete("Location");
110 |         response.headers.set("Content-Type", "application/json");
111 |         return new Response(JSON.stringify({ url: redirect }), {
112 |             status: internalResponse.status,
                                        ^
RangeError: The status provided (0) must be 101 or in the range of [200, 599]
      at /censored/project-root/node_modules/@auth/core/index.js:112:37


uh-oh: Unexpected AnyRequestContext tag
bun will crash now 😭😭😭

----- bun meta -----
Bun v1.0.11 (f7f6233e) Linux x64 #10-Ubuntu SMP PREEMPT_DYNAMIC Fri Oct 13 13:49:38 UTC 2023
AutoCommand: dotenv
Elapsed: 269446ms | User: 6524ms | Sys: 1603ms
RSS: 0.21GB | Peak: 0.45GB | Commit: 0.21GB | Faults: 608
----- bun meta -----

0   0x55c73a8b94eb
1   ???
2   ???
3   ???
4   ???

Search GitHub issues https://bun.sh/issues or ask for #help in https://bun.sh/discord

thread 26355 panic: Unexpected AnyRequestContext tag
Unwind information for `:0x55c7395f701a` was not available, trace may be incomplete

Additional information

If any extra info is required, feel free to ask. I'm currently on my phone, so the bug report is a bit sparse.

@ttmx ttmx added the bug Something isn't working label Nov 10, 2023
@Electroid Electroid added the crash An issue that could cause a crash label Nov 10, 2023
@Electroid Electroid changed the title Auth.js + SvelteKit crash Auth.js + SvelteKit crash: Unexpected AnyRequestContext tag Nov 10, 2023
@ttmx
Copy link
Author

ttmx commented Nov 11, 2023

I'm not sure this is properly renamed, as the crash happened in node_modules/@auth/core/index.js:112:37, and does not happen in other SvelteKit pages. I may just not be understanding what is going on though. Thank you :)
Ignore this, it's correctly set, I may have read the new title incorrectly.

@Jarred-Sumner
Copy link
Collaborator

This error is an assertion failure where any situation this happens is a bug in bun's (internal) lifecycle of the Request object, which is why the process panics

@Jarred-Sumner
Copy link
Collaborator

This will probably fix it #7048

@ttmx
Copy link
Author

ttmx commented Nov 11, 2023

Thank you Jarred :) this was by far the nicest bug report handling I've had in any project.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
crash An issue that could cause a crash
Projects
None yet
Development

No branches or pull requests

4 participants