# Troubleshooting Postman mock servers

**URL:** <https://community.postman.com/t/troubleshooting-postman-mock-servers/82298>\
**Category:** Help Hub\
**Tags:** tests, collections, mockservers\
**Created:** [July 15, 2025, 7:32am UTC](https://community.postman.com/t/troubleshooting-postman-mock-servers/82298 "2025-07-15T07:32:48Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![nkosbonile](https://avatars.discourse-cdn.com/v4/letter/n/ed655f/32.png) [@nkosbonile](https://community.postman.com/u/nkosbonile)\
**Post date:** [July 15, 2025, 7:32am UTC](https://community.postman.com/t/troubleshooting-postman-mock-servers/82298/1 "2025-07-15T07:32:48Z")

</div>

> **Archived topic — some details may be out of date.**  
> Mock servers built from saved collection examples are still supported. Postman now also has **code-based mocks** : JavaScript request handlers plus a `config.yaml`, stored as files in your Git repository, which you can run locally or deploy. Create one in the app, or use the Postman CLI to generate one from an OpenAPI spec, collection or dataset (`postman mock generate`) and run it (`postman mock run`). See [About mocks](https://learning.postman.com/docs/design-apis/mock-apis/mocks/overview) and [Create a mock](https://learning.postman.com/docs/design-apis/mock-apis/mocks/create-a-mock).  
> Working with an AI coding agent? The [Postman plugin](https://github.com/postmanlabs/postman-plugin) can build and run mocks for you.  
> For current help, see the [Postman docs](https://learning.postman.com/docs/), try the free [Postman tools](https://www.postman.com/tools) (no account needed), or join us on [Discord](https://discord.gg/58aNNsRBGR).

I want to use the mock server to simulate a response and get write tests accordingly here is what I did:

- Saved an example response that I would want to get.

-Create a mock server for my api collection and saved the mock server url in an environment.

- When I try to make a request using the mock server url as the base url, I’m getting the error mentioned.

> Error:getaddrinfo [mockserverid.mock.pstmn.io](http://mockserverid.mock.pstmn.io)

---

<div class="post-metadata">

**Author:** ![danny-dainton](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/danny-dainton/32/29401_2.png) [@danny-dainton](https://community.postman.com/u/danny-dainton)\
**Post date:** [July 15, 2025, 7:51am UTC](https://community.postman.com/t/troubleshooting-postman-mock-servers/82298/2 "2025-07-15T07:51:46Z")

</div>

Hey @nkosbonile 👋🏻

Welcome to the Postman Community :postman:

Could you also share some visual examples of the problem so that we can see what’s happening here?

---

<div class="post-metadata">

**Author:** ![spacecraft-geologi12](https://avatars.discourse-cdn.com/v4/letter/s/b3f665/32.png) [@spacecraft-geologi12](https://community.postman.com/u/spacecraft-geologi12)\
**Post date:** [July 18, 2025, 10:04am UTC](https://community.postman.com/t/troubleshooting-postman-mock-servers/82298/3 "2025-07-18T10:04:15Z")

</div>

> [@nkosbonile](#):
>
> want to use the mock server to simulate a response and get write tests accordingly here is what I did:
> 
> - Saved an example response that I would want to get.
> 
> -Create a mock server for my api collection and saved the mock server url in an environment.
> 
> - When I try to make a request using the mock server url as the base url, I’m getting the error mentioned.
> 
> > Error:getaddrinfo [mockserverid.mock.pstmn.io](http://mockserverid.mock.pstmn.io)

Make sure the mock server is active and you’re using the full URL with `https://`. Also, double-check your environment variable and mock ID—this error usually means the URL is incorrect or unresolved.
