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

Throws an error when the request is a POST request. #44

Open
AggressivelyMeows opened this issue Jan 21, 2023 · 7 comments
Open

Throws an error when the request is a POST request. #44

AggressivelyMeows opened this issue Jan 21, 2023 · 7 comments
Assignees

Comments

@AggressivelyMeows
Copy link

https://github.com/drivly/airtable.do/blob/72641a4382ea369e5a63ef0033dc8bf84051324a/src/worker.js#L101
Has been updated to include the patch I used with webhooks.do. This tricks CTX.do into thinking its a GET request, so it doesnt try to parse the body.

@sam-lippert sam-lippert added the question Further information is requested label Jan 21, 2023
@sam-lippert sam-lippert self-assigned this Jan 21, 2023
@sam-lippert
Copy link
Contributor

Is there any reason that this won't work for you?
image
image

@sam-lippert
Copy link
Contributor

CTX body.patch

@nathanclevenger
Copy link
Member

@sam-lippert I just hit this issue when working with webhooks from Twilio and OpenPhone ... for external things like this we have no say, so we need to fix it.

The logic in ctx.do should be to first read the body to a string with text() ... we need to separate that from the json parsing, because if call json() and it's not JSON then we can't read the body ... And we need to FormData decode, which is just like query params with URLSearchParams for proper decoding ... so if JSON decode fails, we should try URLSearchParams decoding as well.

@nathanclevenger nathanclevenger removed the question Further information is requested label Feb 6, 2023
@sam-lippert sam-lippert added the question Further information is requested label Feb 16, 2023
@sam-lippert
Copy link
Contributor

@nathanclevenger Can you provide a repro, please?

@nathanclevenger
Copy link
Member

@sam-lippert I just added you to the twill account - any POST web hook like this will cause this error ... Twilio let's you change webhooks to GET which is how I was able to get around this issue, but the default POST causes this crash https://console.twilio.com/us1/develop/phone-numbers/manage/incoming/PN4e29347f8fb098c25fdfa9453142a439/configure

@nathanclevenger nathanclevenger removed the question Further information is requested label Feb 16, 2023
@nathanclevenger
Copy link
Member

@AggressivelyMeows can you please provide @sam-lippert with a standalone minimalist repro

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants