how to integrate localtunnel and sendgrid test integration webhook?

255 Views Asked by At

I have written a basic express app. It uses localtunnel to do webhook testing. Working on sendgrid Event notification webhook, I found that the data is not getting delivered to POST route when I do the test integration.

I have tested the api and its localtunnel proxy, they both seem to work just fine. I have also tested the sendgrid webhook and it is sending a post request to the supplied end point.

And there are no typos.

I have tried making my server CORS compatible but it still doesn't work.

Should I prepare my app in any way like installing any module ?

1

There are 1 best solutions below

0
On

You must enable CORS on your server in development. You can do it by the following code.

if(process.env.NODE_ENV !== 'production') {
    app.use(function(req, res, next) {
        res.header("Access-Control-Allow-Origin", "*");
        res.header("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept");
        next();
      });
}

And also use a service like webhook.site rather than localtunnel.me