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

[🐛 Bug]: @cloudflare/next-on-pages --watch keeps rebuilding with pnpm #212

Closed
1 task
hambergerpls opened this issue May 2, 2023 · 2 comments
Closed
1 task
Labels
bug Something isn't working

Comments

@hambergerpls
Copy link

hambergerpls commented May 2, 2023

Cli version

0.10.1

next-on-pages environment related information

System:
Platform: linux
Arch: x64
Version: #1 SMP Fri Jan 27 02:56:13 UTC 2023
CPU: (16) x64 AMD Ryzen 7 5800H with Radeon Graphics
Memory: 8 GB
Shell: Unknown
Binaries:
Node: 18.16.0
Yarn: 1.22.19
npm: 9.5.1
pnpm: N/A
Package Manager Used: pnpm
Relevant Packages:
@cloudflare/next-on-pages: 0.10.1
vercel: N/A
next: N/A

Description

Running npx @cloudflare/next-on-pages --watch or pnpm next-on-pages --watch keeps rebuilding the project. Using npm works fine.

See below:

...
/test/my-app # pnpm dlx @cloudflare/next-on-pages --watch
.../share/pnpm/store/v3/tmp/dlx-1324     |  WARN  deprecated @npmcli/[email protected]
.../share/pnpm/store/v3/tmp/dlx-1324     |  WARN  deprecated [email protected]
.../share/pnpm/store/v3/tmp/dlx-1324     |  WARN  deprecated [email protected]
.../share/pnpm/store/v3/tmp/dlx-1324     | +775 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
.../share/pnpm/store/v3/tmp/dlx-1324     | Progress: resolved 858, reused 775, downloaded 0, added 775, done
⚡️ @cloudflare/next-on-pages CLI v.0.10.1
⚡️ Detected Package Manager: pnpm
⚡️ Preparing project...
⚡️ Project is ready
⚡️ Building project...
▲  .../share/pnpm/store/v3/tmp/dlx-1358     | Progress: resolved 1, reused 0, downloaded 0, added 0
▲  .../share/pnpm/store/v3/tmp/dlx-1358     | Progress: resolved 80, reused 78, downloaded 0, added 0
▲  .../share/pnpm/store/v3/tmp/dlx-1358     | Progress: resolved 179, reused 160, downloaded 0, added 0
▲  .../share/pnpm/store/v3/tmp/dlx-1358     | Progress: resolved 270, reused 243, downloaded 0, added 0
▲  .../share/pnpm/store/v3/tmp/dlx-1358     |  WARN  deprecated @npmcli/[email protected]
▲  .../share/pnpm/store/v3/tmp/dlx-1358     | Progress: resolved 396, reused 345, downloaded 0, added 0
▲  .../share/pnpm/store/v3/tmp/dlx-1358     |  WARN  deprecated [email protected]
▲  .../share/pnpm/store/v3/tmp/dlx-1358     | Progress: resolved 554, reused 438, downloaded 0, added 0
▲  .../share/pnpm/store/v3/tmp/dlx-1358     | Progress: resolved 714, reused 647, downloaded 0, added 0
▲  .../share/pnpm/store/v3/tmp/dlx-1358     |  WARN  deprecated [email protected]
▲  .../share/pnpm/store/v3/tmp/dlx-1358     | Progress: resolved 836, reused 773, downloaded 0, added 0
▲  .../share/pnpm/store/v3/tmp/dlx-1358     | +774 ++++++++++++++++++++++++++++++++
▲  .../share/pnpm/store/v3/tmp/dlx-1358     | Progress: resolved 836, reused 774, downloaded 0, added 651
▲  .../share/pnpm/store/v3/tmp/dlx-1358     | Progress: resolved 836, reused 774, downloaded 0, added 774, done
▲  Vercel CLI 29.0.3
▲  Detected `pnpm-lock.yaml` version 6 generated by pnpm 8...
▲  WARNING: You should not upload the `.next` directory.
▲  Installing dependencies...
▲  Lockfile is up to date, resolution step is skipped
▲  Already up to date
▲  
▲  Done in 1.1s
▲  Detected Next.js version: 13.3.4
▲  Running "pnpm run build"
▲  > [email protected] build /test/my-app
▲  > next build
▲  info  - Linting and checking validity of types...
▲  info  - Creating an optimized production build...
▲  info  - Compiled successfully
▲  info  - Collecting page data...
▲  info  - Generating static pages (0/3)
▲  info  - Generating static pages (3/3)
▲  info  - Finalizing page optimization...
▲  
▲  Route (pages)                              Size     First Load JS
▲  ┌ ○ /                                      4.53 kB        77.7 kB
▲  ├   └ css/977fe3ce042f91bf.css             1.89 kB
▲  ├   /_app                                  0 B            73.1 kB
▲  ├ ○ /404                                   182 B          73.3 kB
▲  └ ℇ /api/hello                             0 B            73.1 kB
▲  + First Load JS shared by all              73.8 kB
▲  ├ chunks/framework-ac88a2a245aea9ab.js   45.2 kB
▲  ├ chunks/main-f0f44bf05bc35991.js        26.9 kB
▲  ├ chunks/pages/_app-7a3eeff3d8d6257f.js  296 B
▲  ├ chunks/webpack-8fa1640cc84ba8fe.js     750 B
▲  └ css/876d048b5dab7c28.css               706 B
▲  ℇ  (Streaming)  server-side renders with streaming (uses React 18 SSR streaming or Server Components)
▲  ○  (Static)     automatically rendered as static HTML (uses no initial props)
▲  Collected static files (public/, static/, .next/static): 4.633ms
▲  Build Completed in .vercel/output [10s]
⚡️ Completed `pnpx vercel build`.
⚡️ Generated '.vercel/output/static/_worker.js'.
⚡️ Running in '--watch' mode. Awaiting changes... (Ctrl+C to exit.)"
⚡️ Detected Package Manager: pnpm
⚡️ Preparing project...
⚡️ Project is ready
⚡️ Building project...
▲  .../share/pnpm/store/v3/tmp/dlx-1531     | Progress: resolved 1, reused 0, downloaded 0, added 0
▲  .../share/pnpm/store/v3/tmp/dlx-1531     | Progress: resolved 71, reused 70, downloaded 0, added 0
▲  .../share/pnpm/store/v3/tmp/dlx-1531     | Progress: resolved 134, reused 115, downloaded 0, added 0
▲  .../share/pnpm/store/v3/tmp/dlx-1531     | Progress: resolved 206, reused 187, downloaded 0, added 0
▲  .../share/pnpm/store/v3/tmp/dlx-1531     | Progress: resolved 264, reused 244, downloaded 0, added 0
▲  .../share/pnpm/store/v3/tmp/dlx-1531     |  WARN  deprecated @npmcli/[email protected]
▲  .../share/pnpm/store/v3/tmp/dlx-1531     | Progress: resolved 380, reused 339, downloaded 0, added 0
▲  .../share/pnpm/store/v3/tmp/dlx-1531     | Progress: resolved 512, reused 471, downloaded 0, added 0
▲  .../share/pnpm/store/v3/tmp/dlx-1531     |  WARN  deprecated [email protected]
▲  .../share/pnpm/store/v3/tmp/dlx-1531     | Progress: resolved 642, reused 601, downloaded 0, added 0
▲  .../share/pnpm/store/v3/tmp/dlx-1531     | Progress: resolved 774, reused 701, downloaded 0, added 0
▲  .../share/pnpm/store/v3/tmp/dlx-1531     |  WARN  deprecated [email protected]
▲  .../share/pnpm/store/v3/tmp/dlx-1531     | Progress: resolved 831, reused 769, downloaded 0, added 0
▲  .../share/pnpm/store/v3/tmp/dlx-1531     | +774 ++++++++++++++++++++++++++++++++
▲  .../share/pnpm/store/v3/tmp/dlx-1531     | Progress: resolved 836, reused 774, downloaded 0, added 3
▲  .../share/pnpm/store/v3/tmp/dlx-1531     | Progress: resolved 836, reused 774, downloaded 0, added 774, done
▲  Vercel CLI 29.0.3
▲  Detected `pnpm-lock.yaml` version 6 generated by pnpm 8...
▲  WARNING: You should not upload the `.next` directory.
▲  Installing dependencies...
▲  Lockfile is up to date, resolution step is skipped
▲  Already up to date
▲  
▲  Done in 1s
▲  Detected Next.js version: 13.3.4
▲  Running "pnpm run build"
▲  > [email protected] build /test/my-app
▲  > next build
▲  info  - Linting and checking validity of types...
▲  info  - Creating an optimized production build...
▲  info  - Compiled successfully
▲  info  - Collecting page data...
▲  info  - Generating static pages (0/3)
▲  info  - Generating static pages (3/3)
▲  info  - Finalizing page optimization...
▲  
▲  Route (pages)                              Size     First Load JS
▲  ┌ ○ /                                      4.53 kB        77.7 kB
▲  ├   └ css/977fe3ce042f91bf.css             1.89 kB
▲  ├   /_app                                  0 B            73.1 kB
▲  ├ ○ /404                                   182 B          73.3 kB
▲  └ ℇ /api/hello                             0 B            73.1 kB
▲  + First Load JS shared by all              73.8 kB
▲  ├ chunks/framework-ac88a2a245aea9ab.js   45.2 kB
▲  ├ chunks/main-f0f44bf05bc35991.js        26.9 kB
▲  ├ chunks/pages/_app-7a3eeff3d8d6257f.js  296 B
▲  ├ chunks/webpack-8fa1640cc84ba8fe.js     750 B
▲  └ css/876d048b5dab7c28.css               706 B
▲  ℇ  (Streaming)  server-side renders with streaming (uses React 18 SSR streaming or Server Components)
▲  ○  (Static)     automatically rendered as static HTML (uses no initial props)
▲  Collected static files (public/, static/, .next/static): 5.082ms
▲  Build Completed in .vercel/output [9s]
⚡️ Completed `pnpx vercel build`.
⚡️ Generated '.vercel/output/static/_worker.js'.
⚡️ Running in '--watch' mode. Awaiting changes... (Ctrl+C to exit.)"
⚡️ Detected Package Manager: pnpm
⚡️ Preparing project...
⚡️ Project is ready
⚡️ Building project...
▲  .../share/pnpm/store/v3/tmp/dlx-1675     | Progress: resolved 1, reused 0, downloaded 0, added 0
...

Reproduction

npm install -g pnpm
pnpm create [email protected]
# Enter for all
cd my-app

edit pages/api/hello.ts to

==========
// Next.js Edge API Routes: https://nextjs.org/docs/api-routes/edge-api-routes

import type { NextRequest } from 'next/server'

export const config = {
  runtime: 'edge',
}

export default async function handler(req: NextRequest) {
    return new Response(JSON.stringify({ name: 'John Doe' }))
}
==========

pnpm dlx @cloudflare/next-on-pages --watch

Pages Deployment ID

No response

Pages Deployment Method

Direct Upload (wrangler pages publish or the @cloudflare/pages-action GitHub Action)

Additional Information

Not sure if it is only on my end as I'm using docker (node:18-alpine) as a dev container as I could not install pnpm in WSL. If it is working on native Linux, then this issue can be closed.

Would you like to help?

  • Would you like to help fixing this bug?
@hambergerpls hambergerpls added the bug Something isn't working label May 2, 2023
@hambergerpls
Copy link
Author

hambergerpls commented May 2, 2023

Solved.

I noticed this code:
https://github.com/cloudflare/next-on-pages/blob/d7e62c7fb99241565b41a664abfde29bbac99755/src/index.ts#L54C19-L67

Strangely my .pnpm-store was in my project folder, so it wasn't ignored.

All I did was changing my .pnpm-store directory with pnpm config set store-dir <new directory> , re-run npx @cloudflare/next-on-pages --watch and the problem is solved. 🤦

@dario-piotrowicz
Copy link
Member

Awesome! 😃

So glad you managed to fix it, if you stumble across this again please reopen the issue and we can just extend the list of files we ignore accordingly, as it should be any easy change anyways 🙂

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

2 participants