9:32:38 AM: Netlify Build
9:32:38 AM: ────────────────────────────────────────────────────────────────
9:32:38 AM:
9:32:38 AM: ❯ Version
9:32:38 AM: @netlify/build 29.33.2
9:32:38 AM:
9:32:38 AM: ❯ Flags
9:32:38 AM: baseRelDir: true
9:32:38 AM: buildId: 65bb65146bcb2900081dd26b
9:32:38 AM: deployId: 65bb65146bcb2900081dd26d
9:32:38 AM:
9:32:38 AM: ❯ Current directory
9:32:38 AM: /opt/build/repo
9:32:38 AM:
9:32:38 AM: ❯ Config file
9:32:38 AM: No config file was defined: using default values.
9:32:38 AM:
9:32:38 AM: ❯ Context
9:32:38 AM: production
9:32:38 AM:
9:32:38 AM: Build command from Netlify app
9:32:38 AM: ────────────────────────────────────────────────────────────────
9:32:38 AM:
9:32:38 AM: $ npm run build
9:32:38 AM: > unfold@0.0.1 build
9:32:38 AM: > astro build
9:32:39 AM: 09:32:39 [build] output: "static"
9:32:39 AM: 09:32:39 [build] directory: /opt/build/repo/dist/
9:32:39 AM: 09:32:39 [build] Collecting build info...
9:32:39 AM: 09:32:39 [build] ✓ Completed in 307ms.
9:32:39 AM: 09:32:39 [build] Building static entrypoints...
9:32:41 AM: 09:32:41 [build] ✓ Completed in 1.32s.
9:32:41 AM: building client (vite)
9:32:41 AM: 09:32:41 [vite] transforming...
9:32:41 AM: 09:32:41 [vite] ✓ 16 modules transformed.
9:32:41 AM: 09:32:41 [vite] rendering chunks...
9:32:41 AM: 09:32:41 [vite] computing gzip size...
9:32:41 AM: 09:32:41 [vite] dist/_astro/page.zjCbv0E3.js 0.72 kB │ gzip: 0.46 kB
9:32:41 AM: 09:32:41 [vite] dist/_astro/hoisted.hgVmI-so.js 121.85 kB │ gzip: 48.74 kB
9:32:41 AM: 09:32:41 [vite] ✓ built in 455ms
9:32:41 AM: generating static routes
9:32:41 AM: 09:32:41 ▶ src/pages/index.astro
9:32:41 AM: 09:32:41 └─ /index.html{"message":"Unauthorized","status":401,"response":"Unauthorized","id":"src/pages/index.astro"}
9:32:41 AM: Hint:
9:32:41 AM: 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.
9:32:41 AM: Stack trace:
9:32:41 AM: at createSafeError (file:///opt/build/repo/node_modules/astro/dist/core/errors/utils.js:64:19)
9:32:41 AM: at cli (file:///opt/build/repo/node_modules/astro/dist/cli/index.js:152:11)
9:32:41 AM:
9:32:41 AM: "build.command" failed
9:32:41 AM: ────────────────────────────────────────────────────────────────
9:32:41 AM:
9:32:41 AM: Error message
9:32:41 AM: Command failed with exit code 1: npm run build (https://ntl.fyi/exit-code-1)
9:32:41 AM:
9:32:41 AM: Error location
9:32:41 AM: In Build command from Netlify app:
9:32:41 AM: npm run build
9:32:41 AM:
9:32:41 AM: Resolved config
9:32:41 AM: build:
9:32:41 AM: command: npm run build
9:32:41 AM: commandOrigin: ui
9:32:41 AM: publish: /opt/build/repo/dist
9:32:41 AM: publishOrigin: ui
9:32:42 AM: Failed during stage "building site": Build script returned non-zero exit code: 2
9:32:42 AM: Build failed due to a user error: Build script returned non-zero exit code: 2
9:32:42 AM: Failing build: Failed to build site
9:32:42 AM: Finished processing build request in 24.514s
I’m having an issue deploying my Astro site, which builds locally just fine. I’m using settings copied from the docs in the index.astro file:
import { useStoryblokApi } from "@storyblok/astro";
import StoryblokComponent from "@storyblok/astro/StoryblokComponent.astro";
import BaseLayout from "../layouts/BaseLayout.astro";
const storyblokApi = useStoryblokApi();
const { data } = await storyblokApi.get("cdn/stories/home", {
version: import.meta.env.DEV ? "draft" : "published",
});
I’ve got the right access token, set to ‘preview’. Everything works fine locally. Is there something simple I’ve missed?