-
Notifications
You must be signed in to change notification settings - Fork 122
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
Investigate having to access req.headers
on Deno to prevent requests from being closed
#350
Comments
Is 1.8.3 the latest version that works? In other words, does this issue already occur with 1.9.0? |
1.8.3 is the latest, yes. |
Besides, if I post to an endpoint directly using curl, I am getting the 401 Unauthorized:
What secret token is meant here? |
OK, I got my bot fixed. Regarding 'secret token is wrong' error, I must pass in the corresponding value to The initial problem with grammY/src/convenience/webhook.ts Lines 142 to 147 in 9aed133
|
Fascinating. Glad to see you found the root cause of the problem. Do you think https://grammy.dev/hosting/supabase.html can be improved to include the relevant information?
Yes, it's still kinda annoying. I'm sure there must be a way to get rid of this. I'd be happy to hear about it if you find anything useful :) |
This is up to you. I am unclear about the issue. I tried to log something else, but only |
This is one of these edge cases that @KnightNiwrem might enjoy spending time on |
req.headers
on Deno to prevent requests from being closed
@sparfenyuk can you check if this still happens with the latest version of grammY? I assume so, but I'd just like to make sure this is still an issue before putting any time into it |
Did you ever forget to use |
I got the same problem. Also with supabase edge functions. sparfenyuk's solution with console.log(req.headers) works |
Sounds like we should report this bug to Deno |
Somebody needs to:
@alire2a do you want to be this somebody? |
I had the same problem and I solved it with this: return await handleUpdate(req.clone()); |
Interesting stuff, perhaps we should do this, too |
Here are the errors I in the Edge Logs
My workaround to this problem was to
import { Bot, webhookCallback, InlineKeyboard, Context } from "https://deno.land/x/grammy@v1.30.0/mod.ts";
import { Bot, webhookCallback, InlineKeyboard, Context } from "https://deno.land/x/grammy@v1.8.3/mod.ts";
|
As per the reasoning behind this, it is a TypeError. This should be fixable in grammY, as this occurs when there's a mismatch between the expected type and the actual type of value or when trying to access properties or methods on undefined or null values. |
Thank you for investigating it. Our webhook handling is so simple that I don't know what could be wrong about it. I have a feeling that the actual framework adapter is perfectly correct in how it implements request and response handling, and that the issue is caused by the order of operations that grammY performs on the adapter. The way this is done is a little complex, but if you have questions about it, drop me a message and I'll spend some time explaining it. I'd like to see this fixed purely out of curiosity already. |
Tried to play around this example. It basically doesn't work as expected. I am getting the following errors in Supabase dashboard:
Note: My edge function works only if grammy is downgraded to 1.8.3.
The text was updated successfully, but these errors were encountered: