Skip to content

fix: better error for invalid content type - #5653

Closed
juliusmarminge wants to merge 2 commits into
nextfrom
better-error
Closed

juliusmarminge wants to merge 2 commits into
nextfrom
better-error

Conversation

@juliusmarminge

Copy link
Copy Markdown
Member

improves error for easier debuggability when no content type handler is found

@juliusmarminge
juliusmarminge requested a review from a team as a code owner April 21, 2024 08:31
@vercel

vercel Bot commented Apr 21, 2024 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
next-prisma-starter ✅ Ready (Inspect) Visit Preview Apr 21, 2024 8:35am
og-image ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 21, 2024 8:35am
www ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 21, 2024 8:35am

@github-actions

github-actions Bot commented Apr 21, 2024 •

Copy link
Copy Markdown
Contributor

Diagnostics Comparison

Details

Numbers

Metric PR next
Files 795 795 (➖ 0)
Lines of Library 40,640 40,640 (➖ 0)
Lines of Definitions 118,090 118,086 (🔺 4)
Lines of TypeScript 4,967 4,967 (➖ 0)
Lines of JavaScript 0 0 (➖ 0)
Lines of JSON 0 0 (➖ 0)
Lines of Other 0 0 (➖ 0)
Identifiers 174,935 174,931 (🔺 4)
Symbols 109,024 109,020 (🔺 4)
Types 89 89 (➖ 0)
Instantiations 0 0 (➖ 0)
Memory used 175,894 175,915 (🔽🟢 -21)
Assignability cache size 0 0 (➖ 0)
Identity cache size 0 0 (➖ 0)
Subtype cache size 0 0 (➖ 0)
Strict subtype cache size 0 0 (➖ 0)

Timings and averages

Metric PR next
max (s) 4.294 4.454 (🔽🟢 -0.16)
min (s) 4.294 4.454 (🔽🟢 -0.16)
avg (s) 4.294 4.454 (🔽🟢 -0.16)
median (s) 4.294 4.454 (🔽🟢 -0.16)
length 1 1 (➖ 0)
unstable timings

Unstable

Timings are not reliable in here

Metric PR next
I/O Read time 0.04 0.04 (➖ 0)
Parse time 0.71 0.72 (🔽🟢 -0.01)
ResolveTypeReference time 0.03 0.03 (➖ 0)
ResolveModule time 0.1 0.11 (🔽🟢 -0.01)
ResolveLibrary time 0.02 0.02 (➖ 0)
Program time 1.04 1.06 (🔽🟢 -0.02)
Bind time 0.42 0.43 (🔽🟢 -0.01)
Total time 1.46 1.5 (🔽🟢 -0.04)

"stack": "[redacted]",
},
"message": "Invalid Content-Type header. This request may not be supported by your tRPC Adapter, or possibly by tRPC at all",
"message": "Invalid Content-Type header 'undefined'. This request may not be supported by your tRPC Adapter, or possibly by tRPC at all",

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe another error than "undefined" for missing ones? 👀

handler = h;
break;
}
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As discussed in discord, I think best to do this in a way which is fairly linear. iterating over and taking a match object from the last in the chain seems to create complexity

We probably want to already know the header at this level in the stack and just ask the content handler if it can handle that type?

@github-actions

Copy link
Copy Markdown
Contributor

This pull request has been locked because we are very unlikely to see comments on closed issues. If you think, this PR is still necessary, create a new one with the same branch. Thank you.

@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Apr 22, 2024
@KATT
KATT deleted the better-error branch November 1, 2024 11:23

This branch was successfully deployed

5 active deployments
Preview – www — 641e1ff1 Deployed Apr 21, 2024 by vercel[bot]
Preview – trpc-next-app-dir — 641e1ff1 Deployed Apr 21, 2024 by vercel[bot]
Preview – next-prisma-starter — 641e1ff1 Deployed Apr 21, 2024 by vercel[bot]
Preview – todomvc — 641e1ff1 Deployed Apr 21, 2024 by vercel[bot]
Preview – og-image — 641e1ff1 Deployed Apr 21, 2024 by vercel[bot]
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants