# Three js with gatsby server side rendering

**URL:** <https://discourse.threejs.org/t/three-js-with-gatsby-server-side-rendering/26095>\
**Category:** Questions\
**Tags:** modules\
**Created:** [May 10, 2021, 7:16am UTC](https://discourse.threejs.org/t/three-js-with-gatsby-server-side-rendering/26095 "2021-05-10T07:16:08Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![asem](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/asem/32/18137_2.png) [@asem](https://discourse.threejs.org/u/asem)\
**Post date:** [May 10, 2021, 7:16am UTC](https://discourse.threejs.org/t/three-js-with-gatsby-server-side-rendering/26095/1 "2021-05-10T07:16:09Z")

</div>

When i run “gatsby build” i got a error

 ![image](https://canada1.discourse-cdn.com/flex035/uploads/threejs/original/3X/4/5/45e2b009cbf3134dc64cb895f4c86023401ff602.png)

Any suggest to fix this problem?

thanks.

---

<div class="post-metadata">

**Author:** ![TienTruong](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/tientruong/32/18139_2.png) [@TienTruong](https://discourse.threejs.org/u/TienTruong)\
**Post date:** [May 10, 2021, 7:19am UTC](https://discourse.threejs.org/t/three-js-with-gatsby-server-side-rendering/26095/2 "2021-05-10T07:19:23Z")

</div>

I got a similar problem, Is there a way to fix this?

---

<div class="post-metadata">

**Author:** ![Mugen87](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/mugen87/32/5645_2.png) [@Mugen87](https://discourse.threejs.org/u/Mugen87)\
**Post date:** [May 10, 2021, 7:32am UTC](https://discourse.threejs.org/t/three-js-with-gatsby-server-side-rendering/26095/3 "2021-05-10T07:32:52Z")

</div>

This should be fixed with the next release `r129`. The respective issue at GitHub is:

> <https://github.com/mrdoob/three.js/pull/21715>
>
> Hello!
> 
> 
> \*\*Description\*\*
> With the latest version (r128) I now get this error… on an SSR architecture:
> 
> !\[image\](https://user-images.githubusercontent.com/15867665/115979722-7cbe0b00-a5c2-11eb-9208-a0915a14eb3b.png)
> 
> This PR fixes the issue by checking if the "document" exists.
