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

Update payload limits for servers #276

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

SebastienGllmt
Copy link
Contributor

Express defaults with a 100kb limit for payloads. The SNEK game requires payloads larger than this

Games built with Paima cannot override server configurations like this themselves though, as game endpoints are simply loaded in Paima through the packaged/endpoints.cjs file using engine.addEndpoints(importTsoaFunction());

To unblock SNEK I added code to loosen these limits. This is not necessarily ideal since it also lets players send larger payloads to games to slow down their server,

Alternatives

  • (won't work) The tsoa library we use to generate the game code does have a way to specify middlewares (link), but my understanding is that middlewares added through app.use in Express are parsed in order they were added, so an error gets thrown before any custom override by a game gets executed (and any modification other than appending at the end with app.use is undefined behavior in Express)

  • We could allow an ENV variable to override the value of this field in particular. It's not great to need an ENV variable for a single sub-config of a tool we use like this, but express doesn't look like it has any standard for standalone configuration files so ENV files may be the only option we have

@SebastienGllmt SebastienGllmt self-assigned this Dec 30, 2023
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

Successfully merging this pull request may close these issues.

1 participant