# Webhook + monitor + sendRequest to localhost failing

**URL:** <https://community.postman.com/t/webhook-monitor-sendrequest-to-localhost-failing/29384>\
**Category:** Help Hub\
**Tags:** monitors, tests, request, webhook\
**Created:** [November 4, 2021, 7:27am UTC](https://community.postman.com/t/webhook-monitor-sendrequest-to-localhost-failing/29384 "2021-11-04T07:27:30Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![przemek.sech](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/przemek.sech/32/10022_2.png) [@przemek.sech](https://community.postman.com/u/przemek.sech)\
**Post date:** [November 4, 2021, 7:27am UTC](https://community.postman.com/t/webhook-monitor-sendrequest-to-localhost-failing/29384/1 "2021-11-04T07:27:30Z")

</div>

### The goal

I want to save PagerDuty webhook data to file.

### My setup

I followed the Webhook API tutorial [Postman Webhooks | Postman Level Up](https://www.youtube.com/redirect?event=video_description&redir_token=QUFFLUhqbDY1YmVxUGxIYm1ycGV2XzcwWjFNaW1MTjVaQXxBQ3Jtc0ttaXZGWkFobW5Cb0k4S3lRQTQ0SnN3Q0lMUWQyV2FyOWhpX0FuYkpwY0dHdDI4a0xhTjYzcjhZTkpZTG1vaG1TVzJPSDcwZUZZdzRYRS16cEI2TkpmRjdqZ0NxeUtoMTZNQnZPQXUzeFZDZzdVVGRROA&q=https%3A%2F%2Fwww.postman.com%2Fpostman%2Fworkspace%2Fthe-exploratory%2Fdocumentation%2F1559645-6f401303-8a55-4d77-911c-c8bbb722abef)  
**And it works**

I wanted to have my webhook payload written to the file, so I followed [Write Responses To File](https://www.postman.com/postman/workspace/postman-answers/documentation/3407886-888860dd-9e3c-4537-a78e-1c3f3db7535c) example  
**And it works** in separation.

Then I combined both and wanted the monitor to call my `http://localhost:3000/write`, but found it’s impossible due to [Postman Monitors Test Failed](https://community.postman.com/t/postman-monitors-test-failed/2880).

So I wanted to outsmart the system, and instead of calling `http://localhost:3000/write` directly, I’m calling `https://postman-echo.com/post` (which is publically accessible), and I wrote a test to make the request to my _localhost_.

```auto
const postRequest = {
  url: 'http://localhost:3000/write',
  method: 'POST',
  header: {
    'Content-Type': 'application/json'
  },
  body: {
    "uniqueIdentifier": true,
    "requestName": "pagerduty-listaner",
    "responseData": webhookData
  }
};

// Sending request
console.log("Sending request", postRequest)
pm.sendRequest(postRequest, (err, res) => {
    console.log(err ? err : res.json())
})

```

As you can guess, it did not work, and I’m receiving  
`	Error: NETERR: getaddrinfo ENOTFOUND localhost`

### Any suggestions?

I’ll be trying AWS Gateway + Lambda + S3 tomorrow if no luck with Postman webhook. However, it’s a pretty heavy setup for a simple task I have 🤷🏻‍♂️

### Details (like screenshots)

 ![Screen Shot 2021-11-04 at 6.18.41 pm](https://us1.discourse-cdn.com/getpostman/original/2X/3/3010311289badb844d40b54f9b6322d65e595834.png)
