# Using a .PEM Key in the Collection Runner

**URL:** <https://community.postman.com/t/using-a-pem-key-in-the-collection-runner/51651>\
**Category:** Help Hub\
**Tags:** variables, certificates, collections, collection-runner\
**Created:** [September 12, 2023, 10:04am UTC](https://community.postman.com/t/using-a-pem-key-in-the-collection-runner/51651 "2023-09-12T10:04:43Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![minisquall](https://avatars.discourse-cdn.com/v4/letter/m/7ea924/32.png) [@minisquall](https://community.postman.com/u/minisquall)\
**Post date:** [September 12, 2023, 10:04am UTC](https://community.postman.com/t/using-a-pem-key-in-the-collection-runner/51651/1 "2023-09-12T10:04:43Z")

</div>

Hello, I have a problem with the Runner. I have a POST request with several variables defined in the POST request. This POST request uses an OPTIONS request that contains signature information.

I have added my .PEM key in Postman as a variable. When I execute the POST request alone with the variables, it works; however, when I run the runner, it returns an error.

---

<div class="post-metadata">

**Author:** ![michaelderekjones](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/michaelderekjones/32/14819_2.png) [@michaelderekjones](https://community.postman.com/u/michaelderekjones)\
**Post date:** [September 12, 2023, 11:00am UTC](https://community.postman.com/t/using-a-pem-key-in-the-collection-runner/51651/2 "2023-09-12T11:00:48Z")

</div>

How are you storing the variable?

Perhaps include a screenshot to provide more context.

And what error is being returned?

---

<div class="post-metadata">

**Author:** ![minisquall](https://avatars.discourse-cdn.com/v4/letter/m/7ea924/32.png) [@minisquall](https://community.postman.com/u/minisquall)\
**Post date:** [September 13, 2023, 6:36am UTC](https://community.postman.com/t/using-a-pem-key-in-the-collection-runner/51651/3 "2023-09-13T06:36:53Z")

</div>

i have error → Error: Invalid PEM formatted message.

My variable :  
API\_BASE\_URL  
access\_token  
private\_key  
key\_id  
payload

I specify that I can run it outside of the unit runner.

I think there must be a connection with the OPTIONS request used to generate the signature for the POST request.

---

<div class="post-metadata">

**Author:** ![michaelderekjones](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/michaelderekjones/32/14819_2.png) [@michaelderekjones](https://community.postman.com/u/michaelderekjones)\
**Post date:** [September 13, 2023, 9:01am UTC](https://community.postman.com/t/using-a-pem-key-in-the-collection-runner/51651/4 "2023-09-13T09:01:01Z")

</div>

How are you storing the variables?

Local, Collection or Environment.

[Using variables | Postman Learning Center](https://learning.postman.com/docs/sending-requests/variables/)

Check the console logs for the failing requests. You should be able to see the headers and requests. See what is different from a working request. (If its missing any variables or not).

---

<div class="post-metadata">

**Author:** ![minisquall](https://avatars.discourse-cdn.com/v4/letter/m/7ea924/32.png) [@minisquall](https://community.postman.com/u/minisquall)\
**Post date:** [September 13, 2023, 9:26am UTC](https://community.postman.com/t/using-a-pem-key-in-the-collection-runner/51651/5 "2023-09-13T09:26:50Z")

</div>

Thanks for your help.

I have already looked into all of that. I feel like my POST request is not loading the OPTIONS request script with the runner. Everything is correct regarding the variables…

In the request itself, I have some variables, but these are present in the file I pass to the runner. However, the rest is in the collection.

---

<div class="post-metadata">

**Author:** ![michaelderekjones](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/michaelderekjones/32/14819_2.png) [@michaelderekjones](https://community.postman.com/u/michaelderekjones)\
**Post date:** [September 13, 2023, 9:29am UTC](https://community.postman.com/t/using-a-pem-key-in-the-collection-runner/51651/6 "2023-09-13T09:29:35Z")

</div>

So where are the “options” set for the working request.

Are they not stored as a variable?

Do you have a screenshot of the working request?

---

<div class="post-metadata">

**Author:** ![minisquall](https://avatars.discourse-cdn.com/v4/letter/m/7ea924/32.png) [@minisquall](https://community.postman.com/u/minisquall)\
**Post date:** [September 13, 2023, 9:38am UTC](https://community.postman.com/t/using-a-pem-key-in-the-collection-runner/51651/7 "2023-09-13T09:38:18Z")

</div>

is Here for my request OPT:

 ![image](https://us1.discourse-cdn.com/getpostman/original/3X/0/4/04cafb67d6d83c7fa039503a25c58567306f7228.png)

And POST :

 ![image](https://us1.discourse-cdn.com/getpostman/original/3X/8/4/8471ccf2e9b06b977415352602f02c0772f2e2dd.png)

---

<div class="post-metadata">

**Author:** ![michaelderekjones](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/michaelderekjones/32/14819_2.png) [@michaelderekjones](https://community.postman.com/u/michaelderekjones)\
**Post date:** [September 13, 2023, 9:55am UTC](https://community.postman.com/t/using-a-pem-key-in-the-collection-runner/51651/8 "2023-09-13T09:55:18Z")

</div>

Console log your variables, as I suspect its a scoping thing.

The collection runner keeps everything to itself. It’s fairly self contained when it runs.

Therefore I’m not sure the global variable will be available for that run.

However, console log it to prove this either way.

It might need moving to a collection or environment variable. (Do you really need forgeJS available to every collection within Postman?)

I’m assuming that at the end of that pre-request script, it sets a variable of some sort? (Start with console logging that and work backwords through your variables if its not being set correctly).

---

<div class="post-metadata">

**Author:** ![system](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/system/32/29796_2.png) [@system](https://community.postman.com/u/system)\
**Post date:** [December 12, 2023, 9:55am UTC](https://community.postman.com/t/using-a-pem-key-in-the-collection-runner/51651/9 "2023-12-12T09:55:31Z")

</div>

Closed on December 12, 2023, 9:55am UTC

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.
