Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unauthorized error when building #372

Open
PierrickLozach opened this issue Dec 24, 2024 · 0 comments
Open

Unauthorized error when building #372

PierrickLozach opened this issue Dec 24, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@PierrickLozach
Copy link

PierrickLozach commented Dec 24, 2024

Describe the bug

When running pnpm build, I get this error:

@repo/cms#build > cache hit, replaying logs 5f41826802c0a0da
│
│
│ > @repo/[email protected] build /Users/pierrick.lozach/Documents/Projects/sedlexpro3/packages/cms
│ > basehub
│
│ 🪄 Generating...
│ ┌───────────────────────────────────────────────────────────────────────────────────────┐
│ │ 🎫 SDK Version: 7.5.28                                                                │
│ │ 🔗 Endpoint: https://api.basehub.com/graphql                                          │
│ │ 🔵 Draft: disabled                                                                    │
│ │ 📦 Output: /Users/pierrick.lozach/Documents/Projects/sedlexpro3/packages/cms/.basehub │
│ │ 🔀 Ref: main (basehub branch)                                                         │
│ └───────────────────────────────────────────────────────────────────────────────────────┘
│ ✔ generating the client in `/Users/pierrick.lozach/Documents/Projects/sedlexpro3/packages/cms/.basehub`
│ 📦 Compiling to JavaScript...
│ 🪄 Generated `basehub` client in 2075ms
└────>
┌ @repo/database#build > cache hit, replaying logs facee9d527bebe70
│
│
│ > @repo/[email protected] build /Users/pierrick.lozach/Documents/Projects/sedlexpro3/packages/database
│ > prisma generate --no-hints
│
│ Environment variables loaded from .env
│ Prisma schema loaded from prisma/schema.prisma
│
│ ✔ Generated Prisma Client (v6.1.0) to ./../../node_modules/.pnpm/@[email protected][email protected]/node_modules/@prisma/client in 257ms
└────>
┌ api#build > cache hit, replaying logs 870ab395a7635a81
│
│
│ > api@ build /Users/pierrick.lozach/Documents/Projects/sedlexpro3/apps/api
│ > next build
│
│    ▲ Next.js 15.1.0
│    - Environments: .env.local
│
│    Creating an optimized production build ...
│  ✓ Compiled successfully
│  ✓ Linting and checking validity of types
│  ⚠ Using edge runtime on a page currently disables static generation for that page
│  ✓ Collecting page data
│  ✓ Generating static pages (8/8)
│  ✓ Collecting build traces
│  ✓ Finalizing page optimization
│
│ Route (app)                               Size     First Load JS
│ ┌ ○ /apple-icon.png                       0 B                0 B
│ ├ ƒ /cron/keep-alive                      142 B           102 kB
│ ├ ƒ /health                               142 B           102 kB
│ ├ ○ /icon.png                             0 B                0 B
│ ├ ○ /opengraph-image.png                  0 B                0 B
│ ├ ƒ /webhooks/clerk                       142 B           102 kB
│ └ ƒ /webhooks/stripe                      142 B           102 kB
│ + First Load JS shared by all             101 kB
│   ├ chunks/7564af14-533e5b482ec3d8d0.js   53 kB
│   ├ chunks/main-app-c9985c5bdc352f1a.js   47 kB
│   └ other shared chunks (total)           1.4 kB
│
│ Route (pages)                             Size     First Load JS
│ ─ ○ /404                                  190 B          97.5 kB
│ + First Load JS shared by all             97.3 kB
│   ├ chunks/framework-9e57601ef42221a8.js  57.5 kB
│   ├ chunks/main-98cba1b2372c60e3.js       38.2 kB
│   └ other shared chunks (total)           1.59 kB
│
│ ○  (Static)   prerendered as static content
│ ƒ  (Dynamic)  server-rendered on demand
└────>
┌ web#build > cache miss, executing 33ef6d8f3104ca17
│
│
│ > web@ build /Users/pierrick.lozach/Documents/Projects/sedlexpro3/apps/web
│ > next build
│
│    ▲ Next.js 15.1.0
│    - Environments: .env.local
│
│    Creating an optimized production build ...
│  ✓ Compiled successfully
│  ✓ Linting and checking validity of types
│    Collecting page data  ...Error: Unauthorized: {"error":"Unauthorized"}
│     at s (.next/server/chunks/726.js:1:2266)
│     at async (.next/server/chunks/726.js:1:2363)
│     at async n.query (.next/server/chunks/726.js:1:5632)
│     at async Object.getPosts (.next/server/chunks/726.js:1:17401)
│     at async (.next/server/app/sitemap.xml/route.js:1:1655)
│ Error: Unauthorized: {"error":"Unauthorized"}
│     at s (.next/server/chunks/726.js:1:2266)
│     at async (.next/server/chunks/726.js:1:2363)
│     at async n.query (.next/server/chunks/726.js:1:5632)
│     at async Object.getPosts (.next/server/chunks/726.js:1:17860)
│     at async Object.b [as generateStaticParams] (.next/server/app/legal/[slug]/page.js:1:5908)
│
│ > Build error occurred
│ [Error: Failed to collect page data for /sitemap.xml] { type: 'Error' }
│  ELIFECYCLE  Command failed with exit code 1.
│ command finished with error: command (/Users/pierrick.lozach/Documents/Projects/sedlexpro3/apps/web) /Users/pierrick.lozach/Library/pnpm/pnpm run build exited
│ (1)
└────>
web#build: command (/Users/pierrick.lozach/Documents/Projects/sedlexpro3/apps/web) /Users/pierrick.lozach/Library/pnpm/pnpm run build exited (1)

 Tasks:    5 successful, 7 total
Cached:    4 cached, 7 total
  Time:    26.411s
Failed:    web#build

 ERROR  run failed: command  exited (1)
 ELIFECYCLE  Command failed with exit code 1.

next-forge version

2.21.8

I have checked that the BASEHUB_TOKEN is present in the /web/.env.local file and starts with bshb_pk_. The same token is also in the .env file under /packages/cms.

What else should I check?

@PierrickLozach PierrickLozach added the bug Something isn't working label Dec 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant