This message was deleted.
# helpdesk
s
This message was deleted.
1
b
The docker instance doesn’t work. I get no feedback. I just installed the brew version and running the same yaml file. I only see
webhook {}
in the nest console. I have outputted both @Body which is supposed to capture req.body and also getting the request and outputting req.body. Same output.
Copy code
async webhook(@Req() req: RawBodyRequest<Request>) {
    const raw = req.rawBody; // returns a `Buffer`.
    console.log(raw);
I now get undefined.
I have literally no idea what I am doing. I don’t use nestjs at all. Hopefully this helps someone. My main.ts:
Copy code
import { NestFactory } from '@nestjs/core';
import { AppModule } from './app/app.module';
import { urlencoded, json } from 'express';
import * as bodyParser from 'body-parser';

async function bootstrap() {
  const app = await NestFactory.create(AppModule, {
    bodyParser: false,
  });

  const rawBodyBuffer = (req, res, buf: Buffer, encoding) => {
    console.log('buff', buf.toString());
    if (buf && buf.length) {
      req.rawBody = buf.toString(encoding || 'utf8');
    }
  };

  app.use(bodyParser.json());
  app.use(bodyParser.text());
  app.use(bodyParser.urlencoded());

  app.use(
    bodyParser.raw({
      verify: rawBodyBuffer,
      type: ['*/*'],
    }),
  );

  app.enableCors();
  app.setGlobalPrefix('api');
  app.use(json({ limit: '50mb' }));
  app.use(urlencoded({ extended: true, limit: '50mb' }));
  await app.listen(process.env.LISTEN_PORT);
}
bootstrap();
1
m
Hey @bulky-pizza-75657, just want to verify you got past this? Or still stuck here?
🙌 1
b
@magnificent-art-43333 Thanks for responding! I got past this. The above should help any other devs who use nest. As I see searching for similar posts. Many other devs use express.
❤️ 1
🙏 1
m
Appreciate you posting this here for other devs. Now I just gotta figure out how to get this content somewhere that’s searchable after Slack removes their Premium free trial. 🤔
🙌 1