storyblok / storyblok-astro

Astro SDK for Storyblok CMS
MIT License
164 stars 29 forks source link

Indecipherable 404 errors #169

Closed brightonmike closed 9 months ago

brightonmike commented 1 year ago

Error I'm getting:

▶ src/pages/[...slug].astro
 error   {"message":{},"status":404,"id":"src/pages/[...slug].astro"}
  Hint:
    To get as much information as possible from your errors, make sure to throw Error objects instead of `object`. See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error for more information.
  Stacktrace:
Error: {"message":{},"status":404,"id":"src/pages/[...slug].astro"}
    at createSafeError (file:///Users/michael/Sites/meanwhile/node_modules/astro/dist/core/errors/utils.js:53:19)
    at throwAndExit (file:///Users/michael/Sites/meanwhile/node_modules/astro/dist/cli/index.js:225:52)
    at cli (file:///Users/michael/Sites/meanwhile/node_modules/astro/dist/cli/index.js:211:11)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

I know it's relating to content changes within Storyblok, but the error above gives us absolutely no information regarding where the problem lies. So debugging these errors is a huge time sink.

That these errors occur in the first place is very frustrating - we're unable to have anything in Storyblok that we didn't add to the code base.

manuelschroederdev commented 1 year ago

Hey @brightonmike, thanks for reporting this issue. Could you please, if possible, provide some steps to reproduce this issue directly? We'll look into it ASAP.

Soviut commented 1 year ago

I ran in to something similar when I changed over to the publishing pipeline, rather than just retrieving drafts from the Storyblok API. The solution was two parts:

danny-goose commented 1 year ago

After pressing publish rather than save, npm run build worked, this is the error I was getting.

 src/pages/index.astro
  └─ /index.html (+525ms)
▶ src/pages/contact.astro
  └─ /contact/index.html (+61ms)
▶ src/pages/pricing.astro
  └─ /pricing/index.html (+5ms)
▶ src/pages/about.astro
  └─ /about/index.html (+9ms)
▶ src/pages/blog/[slug].astro
  ├─ /blog/blog-blog2/index.html (+429ms)
  └─ /blog/blog-blog1/index.html (+25ms)
▶ src/pages/blog.astro
 error   "{\"message\":\"Not Found\",\"status\":404,\"response\":\"This record could not be found\"}"
  Hint:
    To get as much information as possible from your errors, make sure to throw Error objects instead of `string`. See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error for more information.
  File:
    /Users/danielisrael/Documents/astroship-main/node_modules/astro/dist/core/errors/utils.js:64:19
  Code:
    63 |   } else {
    > 64 |     const error = new Error(JSON.stringify(err));
         |                   ^
      65 |     error.hint = `To get as much information as possible from your errors, make sure to throw Error objects instead of \`${typeof err}\`. See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error for more information.`;
      66 |     return error;
      67 |   }
  Stacktrace:
Error: "{\"message\":\"Not Found\",\"status\":404,\"response\":\"This record could not be found\"}"
    at createSafeError (file:///Users/danielisrael/Documents/astroship-main/node_modules/astro/dist/core/errors/utils.js:64:19)
    at throwAndExit (file:///Users/danielisrael/Documents/astroship-main/node_modules/astro/dist/cli/throw-and-exit.js:16:50)
    at cli (file:///Users/danielisrael/Documents/astroship-main/node_modules/astro/dist/cli/index.js:147:11)

And here's the error when I forgot to add the environment variables to Vercel, which was actually fairly helpful.



error   "{\"message\":\"Unauthorized\",\"status\":401,\"response\":\"Unauthorized\"}"
--
16:37:24.919 | Hint:
16:37:24.920 | To get as much information as possible from your errors, make sure to throw Error objects instead of `string`. See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error for more information.
16:37:24.920 | File:
16:37:24.920 | /vercel/path0/node_modules/astro/dist/core/errors/utils.js:64:19
16:37:24.920 | Code:
16:37:24.920 | 63 \|   } else {
16:37:24.920 | > 64 \|     const error = new Error(JSON.stringify(err));
16:37:24.920 | \|                   ^
16:37:24.920 | 65 \|     error.hint = `To get as much information as possible from your errors, make sure to throw Error objects instead of \`${typeof err}\`. See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error for more information.`;
16:37:24.920 | 66 \|     return error;
16:37:24.920 | 67 \|   }
16:37:24.920 | Stacktrace:
16:37:24.920 | Error: "{\"message\":\"Unauthorized\",\"status\":401,\"response\":\"Unauthorized\"}"
16:37:24.921 | at createSafeError (file:///vercel/path0/node_modules/astro/dist/core/errors/utils.js:64:19)
16:37:24.921 | at throwAndExit (file:///vercel/path0/node_modules/astro/dist/cli/throw-and-exit.js:16:50)
16:37:24.921 | at cli (file:///vercel/path0/node_modules/astro/dist/cli/index.js:147:11)
16:37:24.921 |  
16:37:24.950 | Error: Command "npm run build" exited with 1

error   "{\"message\":\"Unauthorized\",\"status\":401,\"response\":\"Unauthorized\"}"
--
16:37:24.919 | Hint:
16:37:24.920 | To get as much information as possible from your errors, make sure to throw Error objects instead of `string`. See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error for more information.
16:37:24.920 | File:
16:37:24.920 | /vercel/path0/node_modules/astro/dist/core/errors/utils.js:64:19
16:37:24.920 | Code:
16:37:24.920 | 63 \|   } else {
16:37:24.920 | > 64 \|     const error = new Error(JSON.stringify(err));
16:37:24.920 | \|                   ^
16:37:24.920 | 65 \|     error.hint = `To get as much information as possible from your errors, make sure to throw Error objects instead of \`${typeof err}\`. See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error for more information.`;
16:37:24.920 | 66 \|     return error;
16:37:24.920 | 67 \|   }
16:37:24.920 | Stacktrace:
16:37:24.920 | Error: "{\"message\":\"Unauthorized\",\"status\":401,\"response\":\"Unauthorized\"}"
16:37:24.921 | at createSafeError (file:///vercel/path0/node_modules/astro/dist/core/errors/utils.js:64:19)
16:37:24.921 | at throwAndExit (file:///vercel/path0/node_modules/astro/dist/cli/throw-and-exit.js:16:50)
16:37:24.921 | at cli (file:///vercel/path0/node_modules/astro/dist/cli/index.js:147:11)
16:37:24.921 |  
16:37:24.950 | Error: Command "npm run build" exited with 1

error   "{\"message\":\"Unauthorized\",\"status\":401,\"response\":\"Unauthorized\"}"
--
16:37:24.919 | Hint:
16:37:24.920 | To get as much information as possible from your errors, make sure to throw Error objects instead of `string`. See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error for more information.
16:37:24.920 | File:
16:37:24.920 | /vercel/path0/node_modules/astro/dist/core/errors/utils.js:64:19
16:37:24.920 | Code:
16:37:24.920 | 63 \|   } else {
16:37:24.920 | > 64 \|     const error = new Error(JSON.stringify(err));
16:37:24.920 | \|                   ^
16:37:24.920 | 65 \|     error.hint = `To get as much information as possible from your errors, make sure to throw Error objects instead of \`${typeof err}\`. See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error for more information.`;
16:37:24.920 | 66 \|     return error;
16:37:24.920 | 67 \|   }
16:37:24.920 | Stacktrace:
16:37:24.920 | Error: "{\"message\":\"Unauthorized\",\"status\":401,\"response\":\"Unauthorized\"}"
16:37:24.921 | at createSafeError (file:///vercel/path0/node_modules/astro/dist/core/errors/utils.js:64:19)
16:37:24.921 | at throwAndExit (file:///vercel/path0/node_modules/astro/dist/cli/throw-and-exit.js:16:50)
16:37:24.921 | at cli (file:///vercel/path0/node_modules/astro/dist/cli/index.js:147:11)
16:37:24.921 |  
16:37:24.950 | Error: Command "npm run build" exited with 1
schabibi1 commented 9 months ago

Hi, it's been a while since the last conversation has been active. I'll close this issue as I see some findings to solve. Please feel free to re-open this issue if you still need help with reproduction.

vvaldesc commented 7 months ago

Similar error solved here: https://github.com/storyblok/storyblok-astro/issues/574

I get similar error too: https://github.com/storyblok/storyblok-astro/issues/800