Netlify ReferenceError: document is not defined

Hello everyone, I have a vuejs app that works perfectly fine on my local but, when I try to build it on netlify I get this error. Any debugging tips to help solve this is appreciated
9:18:29 PM: Build ready to start
9:18:31 PM: build-image version: 2dbd444fcdce00cf06325060a8238d5ae3e86774
9:18:31 PM: build-image tag: v3.3.7
9:18:31 PM: buildbot version: d305548225ac57bb00eb5a596b0b8674e76a4681
9:18:31 PM: Fetching cached dependencies
9:18:31 PM: Starting to download cache of 158.9MB
9:18:38 PM: Finished downloading cache in 6.298591843s
9:18:38 PM: Starting to extract cache
9:18:45 PM: Finished extracting cache in 7.041977085s
9:18:45 PM: Finished fetching cache in 13.39495432s
9:18:45 PM: Starting to prepare the repo for build
9:18:45 PM: Preparing Git Reference refs/heads/master
9:18:46 PM: Starting build script
9:18:46 PM: Installing dependencies
9:18:47 PM: Started restoring cached node version
9:18:51 PM: Finished restoring cached node version
9:18:52 PM: v10.20.1 is already installed.
9:18:54 PM: Now using node v10.20.1 (npm v6.14.4)
9:18:54 PM: Attempting ruby version 2.6.2, read from environment
9:18:56 PM: Using ruby version 2.6.2
9:18:56 PM: Using PHP version 5.6
9:18:56 PM: Started restoring cached node modules
9:18:56 PM: Finished restoring cached node modules
9:18:56 PM: Started restoring cached yarn cache
9:18:56 PM: Finished restoring cached yarn cache
9:18:57 PM: Installing NPM modules using Yarn version 1.17.0
9:18:58 PM: yarn install v1.17.0
9:18:58 PM: [1/4] Resolving packages…
9:18:58 PM: [2/4] Fetching packages…
9:19:12 PM: info fsevents@1.2.12: The platform “linux” is incompatible with this module.
9:19:12 PM: info “fsevents@1.2.12” is an optional dependency and failed compatibility check. Excluding it from installation.
9:19:12 PM: [3/4] Linking dependencies…
9:19:12 PM: warning " > @fortawesome/vue-fontawesome@0.1.9" has unmet peer dependency “vue@~2”.
9:19:12 PM: warning " > buefy@0.8.16" has unmet peer dependency “vue@^2.5.18”.
9:19:19 PM: [4/4] Building fresh packages…
9:19:21 PM: Done in 23.70s.
9:19:21 PM: NPM modules installed using Yarn
9:19:22 PM: Started restoring cached go cache
9:19:22 PM: Finished restoring cached go cache
9:19:22 PM: unset GOOS;
9:19:22 PM: unset GOARCH;
9:19:22 PM: export GOROOT=’/opt/buildhome/.gimme/versions/go1.12.linux.amd64’;
9:19:22 PM: export PATH="/opt/buildhome/.gimme/versions/go1.12.linux.amd64/bin:${PATH}";
9:19:22 PM: go version >&2;
9:19:22 PM: export GIMME_ENV=’/opt/buildhome/.gimme/env/go1.12.linux.amd64.env’;
9:19:22 PM: go version go1.12 linux/amd64
9:19:22 PM: Installing missing commands
9:19:22 PM: Verify run directory
9:19:22 PM: Executing user command: gridsome build
9:19:22 PM: Gridsome v0.7.14
9:19:23 PM: Initializing plugins…
9:19:23 PM: Load sources - 0s
9:19:23 PM: Create GraphQL schema - 0.04s
9:19:23 PM: Create pages and templates - 0.04s
9:19:23 PM: Generate temporary code - 0.04s
9:19:23 PM: Bootstrap finish - 0.95s
9:19:23 PM: Compiling assets…
9:19:41 PM: Compile assets - 17.58s
9:19:41 PM: Execute GraphQL (3 queries) - 0s
9:19:41 PM: Write out page data (3 files) - 0s

9:19:41 PM: Could not generate HTML for “/login/”:
9:19:41 PM: ReferenceError: document is not defined
9:19:41 PM: at Object.set (node_modules/vue-cookies/vue-cookies.js:86:0)
9:19:41 PM: at Module.main (src/main.js:28:15)
9:19:41 PM: at runMain (node_modules/gridsome/app/app.js:55:24)
9:19:41 PM: at Module. (node_modules/gridsome/app/entry.server.js:3:0)
9:19:41 PM: at webpack_require (webpack/bootstrap:25:0)
9:19:41 PM: at Object. (assets/js/app.041de48b.js:3855:18)
9:19:41 PM: at webpack_require (webpack/bootstrap:25:0)
9:19:41 PM: at assets/js/app.041de48b.js:118:18
9:19:41 PM: at Object. (assets/js/app.041de48b.js:121:10)
9:19:41 PM: at o (/opt/build/repo/node_modules/vue-server-renderer/
9:19:41 PM: Skipping functions preparation step: no functions directory set

Hey! Are you using server-side rendering by any chance? I’m afraid that won’t work. I believe this thread is describing a similar issue, with several suggestions for generating your page with the client side only:

I’m also linking to Gridsome docs that explain how to adapt your code to not use SSR:

Want to try to some of the suggestions there and let us know if we can help further?