Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Express defaults with a
100kb
limit for payloads. The SNEK game requires payloads larger than thisGames 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 usingengine.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 throughapp.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 withapp.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