charset=utf8 results in empty input
I'm using trpc-openapi and some of our customers are using Zapier to communicate with it.
Zapier uses the header
Content-Type: application/json; charset=utf-8
- note the additional charset=utf-8
When charset=utf-8
exists, the input to the relevant procedure is {}
Has anybody encountered this? Is there a way to support it?14 Replies
Note I'm using
adapters/aws-lambda
i think i know why this is happening
@sachinraja - a penny for your thoughts?
I found a few string comparisons to "application/json" in the codebase - I thought that might be it
yeah ill do a PR - should probably be doing
.includes
instead
sorry i meant to follow up on this lolThanks @sachinraja ❤️
can i ask you to try something with a patch (
patch-package
)?I'm just in a meeting right now - I'd be happy to give it a crack in about 1h
awesome 👍
n.b. I'm on Yarn 3 which has it's own patch package system. I can just do a patch manually though
if need be
ok cool
ill see if i can do a canary publish
actually I thought I knew why this was happening but now I do not. I just read that you're using the aws lambda adapter so that avoids a lot of potential issues I thought this could be related to. Also not sure why the input comes through as an empty object. Might be some aws specific stuff happening
I'm back now
So here's a wrapper function I'm using to hack the adapter
I also noted that the comparisons to
"application/json"
didn't exist in the aws-lambda adapter
But as you can see in this wrapper, adjusting event.headers["content-type"]
causes createOpenApiAwsLambdaHandler
to behave correctly
Usage in case it's not clear
interesting
quite an annoying bug
i don’t think i can get around to fixing this soon anymore (will be gone for about 2 weeks) but i’ll still keep it in mind
but feel free to create an issue on github, hopefully someone else will pick it up
Thanks @sachinraja
Created an issue on Github https://github.com/trpc/trpc/issues/4783
GitHub
bug: charset=utf8 results in empty input · Issue #4783 · trpc/trpc
Provide environment information Redacted due to privacy and it's not relevant to the bug Describe the bug I'm using trpc-openapi and adapters/aws-lambda. Some of our customers are using Zap...