firebase / firebase/firebase-tools

Next.js SSR: "Couldn't find any 'pages' or 'app' directory. Please create one under the project root"

Open
#7,128 4 comments 0 reactions 0 assignees View on GitHub
integration: web frameworks Needs: Attention type: bug
Dominant language
TypeScript
Stars
4.5k
Forks
1.3k
Avg merge
1d 12h
Merged PRs (30d)
84

Description

### [REQUIRED] Environment info

**firebase-tools:** 13.8.0

**Platform:** macOS

### [REQUIRED] Test case

Our docs using Nextra: https://github.com/SharezoneApp/sharezone-app/tree/main/docs

### [REQUIRED] Steps to reproduce

1. Clone our Nextra docs: https://github.com/SharezoneApp/sharezone-app/tree/main/docs
2. Enable web frameworks
3. Update `firebase.json` and `.firebaserc` to use your own Firebase project
4. Run `firebase deploy`

### [REQUIRED] Expected behavior

No errors in the console.

### [REQUIRED] Actual behavior

We are getting a lot of error in our console for our `ssrsharezonedocsprod` cloud function:

![image](https://github.com/firebase/firebase-tools/assets/24459435/d62f705a-c5a0-4d00-8487-a71212fd5ae2)

```

Error: > Couldn't find any `pages` or `app` directory. Please create one under the project root
at findPagesDir (/workspace/node_modules/next/dist/lib/find-pages-dir.js:42:15)
at findPagesDirectory (/workspace/node_modules/nextra/dist/index.js:169:15)
at Object. (/workspace/node_modules/nextra/dist/index.js:173:53)
at Module._compile (node:internal/modules/cjs/loader:1364:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1422:10)
at Module.load (node:internal/modules/cjs/loader:1203:32)
at Module._load (node:internal/modules/cjs/loader:1019:12)
at Module.require (node:internal/modules/cjs/loader:1231:19)
at mod.require (/workspace/node_modules/next/dist/server/require-hook.js:65:28)
at require (node:internal/modules/helpers:177:18)
```

The source folder of deployed cloud function (downloaded via GCP console):

![image](https://github.com/firebase/firebase-tools/assets/24459435/36d92277-ca4b-4afc-91d1-c1b6f5ec9bb5)

Local `functions` folder in `.firebase`:

![image](https://github.com/firebase/firebase-tools/assets/24459435/da733372-cafa-4d58-9fa3-63d0e526e97e)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.