Closed Dids closed 6 years ago
Commenting out line 117 in Server.js
"fixes" the issue, as it looks like the body-parser added by ROS takes precedence.
As a temporary workaround, I'm removing the ROS added body-parser after startup, like so:
for (let i in this.server.expressApp._router.stack) {
let layer = this.server.expressApp._router.stack[i]
if (layer.name === 'jsonParser') {
this.server.expressApp._router.stack.splice(i, 1)
break
}
}
@nirinchev Was this implemented? Or not going to be implemented at all?
Sorry - it's in a private repo, which is why I guess Github didn't create a publicly visible comment. It was implemented and will be released with the next version. You'll be able to control it by setting:
server.start({
// Other options
jsonBodyLimit: '10mb'
})
@nirinchev I'm assuming this has been released now, since ROS was recently updated on npm?
It is, yes - it shipped with 2.5.0: https://github.com/realm/realm-object-server/blob/master/CHANGELOG.md#enhancements-1
Goals
I'm trying to increase the upload size of POST and PUT requests in a custom
Service
, so using the built-inexpress
app of ROS.Expected Results
I should be able to override body-parser settings, so I could upload larger payloads.
Actual Results
Overriding body-parser settings has zero effect.
Steps to Reproduce
Try to add/use a modified express body-parser, then upload a file or JSON content larger than 10k characters (or roughly 1 MB, I'm assuming).
Server response:
Code Sample
NOTE: I've also tried to override the middlewares after startup, using
this.server.expressApp.use()
, but that produces the same exact results.Version of Realm and Tooling
Logs
Nothing is generated in the logs (even with log level set to
all
).