-
Notifications
You must be signed in to change notification settings - Fork 106
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
bug: aws-lambda webhookCallback adapter doesn't work #412
Comments
Absolutely! I'm looking forward to your contributions :) I believe @amberlionk to be the one who contributed the AWS adapter in #62. In case you have any questions about the implementation, I'm sure we are both open to answer them! |
Sorry for the late reply btw, I was a little busy recently |
@all-contributors add @chrisandrewcl for bug |
I've put up a pull request to add @chrisandrewcl! 🎉 |
@KnorpelSenf I've submitted a PR for review, addressing points 1 and 2. Regarding point 3, is there any way to call an API method on "dry-run" to get only the JSON payload? If not, and if it is something that makes sense for the framework, I can submit a separate feature request (to be considered for a future version) and this issue can be hopefully closed with PR#418. |
I'm not 100 % sure I understand what you mean, but I believe https://grammy.dev/advanced/transformers.html to be the solution. |
I've started experimenting with grammyjs and encountered a few issues while trying to use the aws-lambda adapter for the
webhookCallback
:webhookCallback
returns an async function, which causes the lambda to be called without the callback, resulting in "callback is not a function" errors.Content-Type: application/json
.I was able to work around issues 1 and 2 by setting the header directly and wrapping the handler with a promise:
If my understanding is correct, the framework could be improved by:
webhookCallback
work would spill in a lot of other places and could be too much to ask, but it would be great to have more flexibility by having something asconst reply = ctx.reply(/* ... */, { returnJsonPayload: true })
(disregardingcanUseWebhookReply
) so that we can explicitly set a response after we have done everything else. Is something like this possible in the current version? Without it, I am considering "leaking" the function given tocanUseWebhookReply
so that we can control when it should return true later on each request, but it seems messy. I hope there is a better way.1 and 2 look like good "first issues", so I would like to contribute with a PR if that's ok.
The text was updated successfully, but these errors were encountered: