storyblok / nuxt-ultimate-tutorial

26 stars 11 forks source link

Cannot prerender #71

Closed dylanalizon closed 11 months ago

dylanalizon commented 11 months ago

Expected Behavior

Deploy with SSR on Netlify

Current Behavior

I followed the whole tutorial but when I reached the part about having several environments on Netlify, the prerender didn't work.

✔ Server built in 1066ms                                                                                                               16:17:52
ℹ Initializing prerenderer                                                                                                       nitro 16:17:52
ℹ Prerendering 1 initial routes with crawler                                                                                     nitro 16:17:53
  ├─ / (189ms)                                                                                                                    nitro 16:17:53
  │ └── Error: [500] 
                                                                                                                                  nitro 16:17:53
Errors prerendering:
  ├─ / (189ms)                                                                                                                    nitro 16:17:53
  │ └── Error: [500] 
                                                                                                                                  nitro 16:17:53

 ERROR  Exiting due to prerender errors.                                                                                                16:17:53

  at prerender (node_modules/nitropack/dist/shared/nitro.8059b54f.mjs:215:11)
  at async node_modules/nuxt/dist/index.mjs:2992:7
  at async build (node_modules/nuxt/dist/index.mjs:4389:5)
  at async Object.run (node_modules/nuxi/dist/chunks/build.mjs:98:5)
  at async runCommand$1 (node_modules/nuxi/dist/shared/nuxi.4fde776c.mjs:1648:16)
  at async runCommand$1 (node_modules/nuxi/dist/shared/nuxi.4fde776c.mjs:1639:11)
  at async runMain$1 (node_modules/nuxi/dist/shared/nuxi.4fde776c.mjs:1773:7) 

Steps to Reproduce

My is code is the same as the main branch here but with all code about Preview/Prod code uncommented

dylanalizon commented 11 months ago

After some research, this is due to the token used. When a "Public" access token is created, the API returns a 401 error. It's the same with an "Asset" token.

dylanalizon commented 11 months ago

Closed due to use draft mode in the Header.vue