Fix Discord interactions endpoint with proper raw body handling

cgen-2c03539416fa4c19a10472b9201887b7
This commit is contained in:
Builder.io 2025-11-05 17:17:48 +00:00
parent effce4ca87
commit 652cde8a81

View file

@ -8,6 +8,13 @@ import { randomUUID, createHash, createVerify } from "crypto";
export function createServer() {
const app = express();
// Middleware - capture raw body for Discord signature verification
app.use((req, res, buf, encoding) => {
if (buf && buf.length) {
req.rawBody = buf.toString(encoding || 'utf8');
}
});
// Middleware
app.use(cors());
app.use(express.json());