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

feat: Add Vercel Serverless Hosting Support #121

Merged
merged 4 commits into from
Sep 13, 2021

Conversation

KitsuneDev
Copy link
Contributor

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.

@KitsuneDev KitsuneDev requested a review from Snazzah as a code owner September 10, 2021 21:00
@Snazzah
Copy link
Owner

Snazzah commented Sep 10, 2021

Could you add documentation in docs on how to set it up via Vercel?

@Snazzah Snazzah added the type: enhancement New feature or request label Sep 10, 2021
@KitsuneDev
Copy link
Contributor Author

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.

@KitsuneDev
Copy link
Contributor Author

@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.

@Snazzah
Copy link
Owner

Snazzah commented Sep 12, 2021

@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.

@KitsuneDev
Copy link
Contributor Author

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?

@Snazzah
Copy link
Owner

Snazzah commented Sep 13, 2021

Yes, you wouldn't be able to use ctx.registerComponent.

@Snazzah
Copy link
Owner

Snazzah commented Sep 13, 2021

Merging this now, I'll work on the documentation and making sure it works well on Vercel.

@Snazzah Snazzah merged commit 1b2272a into Snazzah:master Sep 13, 2021
chronos-ohm added a commit to cal3xyz/cal3-discord-bot that referenced this pull request Mar 30, 2022
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants