# Getting error using octokit as external library (Pull a library from a CDN) Error: exports is not defined

**URL:** <https://community.postman.com/t/getting-error-using-octokit-as-external-library-pull-a-library-from-a-cdn-error-exports-is-not-defined/36646>\
**Category:** Help Hub\
**Created:** [June 28, 2022, 2:31pm UTC](https://community.postman.com/t/getting-error-using-octokit-as-external-library-pull-a-library-from-a-cdn-error-exports-is-not-defined/36646 "2022-06-28T14:31:26Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![technical-candidate7](https://avatars.discourse-cdn.com/v4/letter/t/e79b87/32.png) [@technical-candidate7](https://community.postman.com/u/technical-candidate7)\
**Post date:** [June 28, 2022, 2:31pm UTC](https://community.postman.com/t/getting-error-using-octokit-as-external-library-pull-a-library-from-a-cdn-error-exports-is-not-defined/36646/1 "2022-06-28T14:31:26Z")

</div>

> Here’s an outline with best practices for making your inquiry.

I have to retrieve the Github pull request, using the url:

`https://api.github.com/repos/<user>/<repo>/pulls/<pr_number>` and the repo`

`https://api.github.com/repos/<user>/<repo>`

I tried to use `Octokit.js` → `https://github.com/octokit/core.js#readme` as is suggested in the Github documentation. I am using the next code:

_Details (like screenshots)_:

```auto
pm.sendRequest("https://cdn.jsdelivr.net/npm/@octokit/rest@18.12.0/dist-node/index.js", (err, res) => {
   //convert the response to text and save it as an environment variable
   pm.collectionVariables.set("octokit_library", res.text());
 
   // eval will evaluate the JavaScript code and initialize the min.js
   eval(pm.collectionVariables.get("octokit_library"));
})

```

But it seems like it is not the correct way to use the `octokit` library in Postman. I got the next error:

`There was an error in evaluating the Pre-request Script:Error: exports is not defined`

I followed the next approach to import external libraries in Postman, using a Pull a library from CDN approach

`https://blog.postman.com/adding-external-libraries-in-postman/`

_How I found the problem_:

I am musing the pre-request-script tab to test the code.

_I’ve already tried_:

If I use the minified version: `https://cdnjs.cloudflare.com/ajax/libs/rest.js/15.2.4/octokit-rest.min.js`

I get a different error message in the Postman console:

> [https://cdnjs.cloudflare.com/ajax/libs/rest.js/15.2.4/octokit-rest.min.js](https://cdnjs.cloudflare.com/ajax/libs/rest.js/15.2.4/octokit-rest.min.js)

---

<div class="post-metadata">

**Author:** ![shailydesai30](https://avatars.discourse-cdn.com/v4/letter/s/3be4f8/32.png) [@shailydesai30](https://community.postman.com/u/shailydesai30)\
**Post date:** [June 6, 2024, 1:15am UTC](https://community.postman.com/t/getting-error-using-octokit-as-external-library-pull-a-library-from-a-cdn-error-exports-is-not-defined/36646/2 "2024-06-06T01:15:28Z")

</div>

Any updates on this question, have you resolved the issue? I have a same issue.

---

<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:** [June 6, 2024, 10:18am UTC](https://community.postman.com/t/getting-error-using-octokit-as-external-library-pull-a-library-from-a-cdn-error-exports-is-not-defined/36646/3 "2024-06-06T10:18:18Z")

</div>

You can only use external libraries in that way if they are completely self contained.

If the library has downstream dependencies on other libraries, then they won’t work and will give you errors related to the missing dependencies which is highly likely to be the issue in this case.
