How to increase the payload size for probot routes? #1830
-
Due to the size of some commit messages (36Kb), the entire payload exceeds the limit allowed by default. I would like to be able to do the following: express.use(bodyParser.urlencoded({ extended: true, limit: '5mb' })) the problem is that i don't have access to the express server that probot uses. Use Server explicitI tried to use the server explicitly and run it with import { Server, Probot } from 'probot'
import express from 'express'
import { getPrivateKey } from '@probot/get-private-key'
import bodyParser from 'body-parser'
require('dotenv').config()
/**
* export default async (app: Probot, { getRouter }: ApplicationFunctionOptions ) => { ... }
*/
import app from './index'
async function startServer () {
console.log('creating server with custom values')
const server = new Server({
Probot: Probot.defaults({
appId: process.env.APP_ID,
privateKey: getPrivateKey(),
secret: process.env.WEBHOOK_SECRET
}),
port: 8081
})
console.log('increasing payload limit')
server.expressApp.use(express.json({ limit: '5mb' }))
server.expressApp.use(express.urlencoded({ limit: '5mb' }))
server.expressApp.use(bodyParser.json({ limit: '5mb' }))
server.expressApp.use(bodyParser.urlencoded({ extended: true, limit: '5mb' }))
console.log('Loading server ... ')
await server.load(app)
return server
}
startServer().then(serv => {
console.log('Starting server ... ')
serv.start()
console.log('After starting server ... ')
}).catch((e) => {
console.log('Server error')
console.log(e)
}).finally(() => {
console.log('Finishing server ... ')
}) Any ideas? Thank you for your answers and suggestions. |
Beta Was this translation helpful? Give feedback.
Answered by
AaronDewes
Jun 2, 2023
Replies: 1 comment 1 reply
-
I'm not 100% sure, but I think you're debugging the wrong issue. You are making an outgoing request that is too large, it seems to handle the payloads just fine. |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
AaronDewes
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I'm not 100% sure, but I think you're debugging the wrong issue. You are making an outgoing request that is too large, it seems to handle the payloads just fine.