File tree Expand file tree Collapse file tree 2 files changed +12
-2
lines changed Expand file tree Collapse file tree 2 files changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -3,14 +3,19 @@ import * as Sentry from '@sentry/node'
33import cors from '@fastify/cors'
44import swagger from '@fastify/swagger'
55import { fastify , FastifyInstance , FastifyServerOptions } from 'fastify'
6- import { PG_META_REQ_HEADER } from './constants.js'
6+ import { PG_META_REQ_HEADER , MAX_BODY_LIMIT } from './constants.js'
77import routes from './routes/index.js'
88import { extractRequestForLogging } from './utils.js'
99// Pseudo package declared only for this module
1010import pkg from '#package.json' with { type : 'json' }
1111
1212export const build = ( opts : FastifyServerOptions = { } ) : FastifyInstance => {
13- const app = fastify ( { disableRequestLogging : true , requestIdHeader : PG_META_REQ_HEADER , ...opts } )
13+ const app = fastify ( {
14+ disableRequestLogging : true ,
15+ requestIdHeader : PG_META_REQ_HEADER ,
16+ bodyLimit : MAX_BODY_LIMIT ,
17+ ...opts ,
18+ } )
1419 Sentry . setupFastifyErrorHandler ( app )
1520
1621 app . setErrorHandler ( ( error , request , reply ) => {
Original file line number Diff line number Diff line change @@ -57,6 +57,11 @@ export const PG_META_MAX_RESULT_SIZE = process.env.PG_META_MAX_RESULT_SIZE_MB
5757 parseInt ( process . env . PG_META_MAX_RESULT_SIZE_MB , 10 ) * 1024 * 1024
5858 : 2 * 1024 * 1024 * 1024 // default to 2GB max query size result
5959
60+ export const MAX_BODY_LIMIT = process . env . PG_META_MAX_BODY_LIMIT_MB
61+ ? // Fastify server max body size allowed, is in bytes, convert from MB to Bytes
62+ parseInt ( process . env . PG_META_MAX_BODY_LIMIT_MB , 10 ) * 1024 * 1024
63+ : 3 * 1024 * 1024
64+
6065export const DEFAULT_POOL_CONFIG : PoolConfig = {
6166 max : 1 ,
6267 connectionTimeoutMillis : PG_CONN_TIMEOUT_SECS * 1000 ,
You can’t perform that action at this time.
0 commit comments