-
-
Notifications
You must be signed in to change notification settings - Fork 47
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
feat: Add Vercel Serverless Hosting Support #121
Conversation
Could you add documentation in |
Sure thing, I’d be more than happy to! I believe it might be quite necessary as well, since it’s setup is quite exquisite, with the need to create an API file - I just really forgot to. |
@Snazzah, I added some Docs explaining how to implement it. I'm not a native speaker, so please let me know if it is unclear. |
@GabrielTK Could you explain in the docs how to deploy it in Vercel? Like what environment keys to use, what the interaction URL should be, etc. |
Actually, I would like to ask you for your opinion on something: Vercel tends to restart the runtime after an HTTP response has been sent, thus clearing all variables - wouldn’t that create an issue with message components such as selects? |
Yes, you wouldn't be able to use |
Merging this now, I'll work on the documentation and making sure it works well on Vercel. |
Note: button.ts does not work on Vercel, because it uses registerComponent(). See Snazzah/slash-create#121 (comment) I suspect every serverless back-end will come with some sort of short-comings since it's unable to keep state in between runs. To keep full functionality I suspect a server such Express with AWS EC2 is necessary.
This adds a
VercelServer
class, which allows the bot to be hosted on Vercel - a free hosting platform for serverless projects strongly integrated with Git.A working code example is available here, is currently being hosted via Vercel and can be tested with this invite link (NOTE: The invite link by default includes Administrator permissions, but that should not change anything. If you feel uncomfortable with testing it this way, just change the
permissions
bit on the URL.