{"record":{"id":"564828a667840bcb","repo":"cube-js/cube","slug":"your-express-app-config-is-missing-body-parser-mid","errorCode":null,"errorMessage":"Your express app config is missing body-parser middleware. Typical config can look like: `app.use(bodyParser.json({ limit: '50mb' }));`","messagePattern":"Your express app config is missing body-parser middleware\\. Typical config can look like: `app\\.use\\(bodyParser\\.json\\((.+?)\\)\\);`","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/cubejs-server-core/src/core/DevServer.ts","lineNumber":164,"sourceCode":"      }\n      res.json({ tablesSchema });\n    }));\n\n    app.get('/playground/files', catchErrors(async (req, res) => {\n      this.cubejsServer.event('Dev Server Files Load');\n      const files = await this.cubejsServer.repository.dataSchemaFiles();\n      res.json({\n        files: files.map(f => ({\n          ...f,\n          absPath: path.resolve(path.join(this.cubejsServer.repository.localPath(), f.fileName))\n        }))\n      });\n    }));\n\n    app.post('/playground/generate-schema', catchErrors(async (req, res) => {\n      this.cubejsServer.event('Dev Server Generate Schema');\n      if (!req.body) {\n        throw new Error('Your express app config is missing body-parser middleware. Typical config can look like: `app.use(bodyParser.json({ limit: \\'50mb\\' }));`');\n      }\n\n      if (!req.body.tables) {\n        throw new Error('You have to select at least one table');\n      }\n\n      const dataSource = req.body.dataSource || 'default';\n\n      const driver = await this.cubejsServer.getDriver({\n        dataSource,\n        authInfo: null,\n        securityContext: null,\n        requestId: getRequestIdFromRequest(req),\n      });\n      const tablesSchema = req.body.tablesSchema || (await driver.tablesSchema());\n\n      if (!Object.values(SchemaFormat).includes(req.body.format)) {\n        throw new Error(`Unknown schema format. Must be one of ${Object.values(SchemaFormat)}`);","sourceCodeStart":146,"sourceCodeEnd":182,"githubUrl":"https://github.com/cube-js/cube/blob/7d981676b36392fec34088b9afab6bdcad40207c/packages/cubejs-server-core/src/core/DevServer.ts#L146-L182","documentation":"The dev server's POST /playground/generate-schema endpoint reads req.body; if body parsing middleware is absent, req.body is undefined and this Error explains that express needs body-parser (json) configured.","triggerScenarios":"Hitting the Playground's generate-schema route from an app whose express instance was created without bodyParser.json() — e.g. custom server setup bypassing cubejs-server's default middleware.","commonSituations":"Custom express servers mounting the Cube dev API without middleware, upgrading express (v4->v5 removing built-in body parsing nuances), or ordering middleware after routes.","solutions":["Add app.use(bodyParser.json({ limit: '50mb' })) before mounting Cube/dev-server routes","Or use express.json({ limit: '50mb' }) (built-in since Express 4.16)","Verify req.body is parsed by logging it on a test POST"],"exampleFix":"// before\nconst app = express();\nserver.init(app);\n// after\nconst app = express();\napp.use(bodyParser.json({ limit: '50mb' }));\nserver.init(app);","handlingStrategy":"validation","validationCode":"function requireBodyParser(app) {\n  const probe = express();\n  // ensure before mounting dev routes:\n  if (!app._router) return;\n  app.use(bodyParser.json({ limit: '50mb' }));\n}","typeGuard":null,"tryCatchPattern":"try { await fetch('/playground/generate-schema', {...}); } catch (e) { if (/body-parser middleware/.test(String(e))) { app.use(bodyParser.json({ limit: '50mb' })); } }","preventionTips":["Always configure body-parser/express.json before Cube routes","Set a generous limit (e.g. 50mb) for playground payloads","Smoke-test POST endpoints after custom server changes","Re-check middleware when upgrading Express major versions"],"tags":["express","middleware","dev-server"],"backgroundTag":"missing-body-parser-middleware","analyzedSha":"7d981676b36392fec34088b9afab6bdcad40207c","analyzedAt":"2026-09-02T03:45:10.400Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T15:18:49.778Z"}