# Error: XMLHttpRequest is not a constructor

**URL:** <https://community.blockcerts.org/t/error-xmlhttprequest-is-not-a-constructor/3560>\
**Category:** Support\
**Created:** [January 30, 2024, 5:17pm UTC](https://community.blockcerts.org/t/error-xmlhttprequest-is-not-a-constructor/3560 "2024-01-30T17:17:42Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ely](https://avatars.discourse-cdn.com/v4/letter/e/87869e/32.png) [@ely](https://community.blockcerts.org/u/ely)\
**Post date:** [January 30, 2024, 5:17pm UTC](https://community.blockcerts.org/t/error-xmlhttprequest-is-not-a-constructor/3560/1 "2024-01-30T17:17:42Z")

</div>

I am using cert verifier js in next 13 and using the npm run build command gives me the following error:

> TypeError: global$1.XMLHttpRequest is not a constructor

Using the npm run dev command the library works correctly

---

<div class="post-metadata">

**Author:** ![lemoustachiste](https://avatars.discourse-cdn.com/v4/letter/l/7c8e57/32.png) [@lemoustachiste](https://community.blockcerts.org/u/lemoustachiste)\
**Post date:** [January 31, 2024, 2:49pm UTC](https://community.blockcerts.org/t/error-xmlhttprequest-is-not-a-constructor/3560/2 "2024-01-31T14:49:20Z")

</div>

I am not familiar with next.js so I’m not entirely sure of what you are trying to achieve and in what conjunction this is failing.

Which version of CVJS is being consumed in your project? cjs, esm, node?  
In the source file, `global$1.XMLHttpRequest` should be assigned a value (most likely an XMLHttpRequest constructor), can you check that this happens.

At this point I’m enclined to say this is a problem with next.js.

---

<div class="post-metadata">

**Author:** ![lemoustachiste](https://avatars.discourse-cdn.com/v4/letter/l/7c8e57/32.png) [@lemoustachiste](https://community.blockcerts.org/u/lemoustachiste)\
**Post date:** [February 2, 2024, 2:18pm UTC](https://community.blockcerts.org/t/error-xmlhttprequest-is-not-a-constructor/3560/3 "2024-02-02T14:18:08Z")

</div>

I’ve seen the bug in one of my project in a node context.

When running in node you need to:

```auto
const { Certificate } = require('@blockcerts/cert-verifier-js/dist/verifier-node');

```
