Skip to content

Update payload limits for servers#276

Draft
SebastienGllmt wants to merge 1 commit intomasterfrom
update-payload-limits
Draft

Update payload limits for servers#276
SebastienGllmt wants to merge 1 commit intomasterfrom
update-payload-limits

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