Production serverless build importing Firestore fails while including 'google/protobuf/api.proto'
See original GitHub issueBug report
Describe the bug
When using import "firebase/firestore" on a page with target: "serverless" in next.config.js, next build fails with the following error:
> Build error occurred
Error: ENOENT: no such file or directory, open 'google/protobuf/api.proto'
To Reproduce
- Clone https://github.com/WestonThayer/bug-nextjs-firestore-grpc
npm installnpm run build
Expected behavior
The production build should succeed. It used to work in next@8.1.0.
System information
- OS: macOS 10.14.6 (Mojave)
- Version of Next.js: 9.3.4
- Version of Node.js: v12.15.0
- Version of Firebase: 7.14.0
Additional context
- The build will succeed if you remove
target: "serverless"fromnext.config.js - Strangely,
next buildsucceeds in the Zeit NOW environment. I see NOW is also using Nodev12.15.0, so scratching my head as to what’s different
Seems like this is something that Next tried to get working in the past:
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:16 (13 by maintainers)
Top Results From Across the Web
Production serverless build importing Firestore fails while ...
When using import "firebase/firestore" on a page with target: "serverless" in next.config.js , next build fails with the following error:.
Read more >Unable to build NextJS app locally when using Firestore
I'm building a web app and am fetching data from the Firestore both on the client and on the server with getStaticProps and...
Read more >Top 10 Serverless Deployment Errors (and How to Fix Them)
The cause: This error is caused when creating a API Gateway resource with a method (GET, PUT, POST, etc.) but not connecting that...
Read more >Cloud Functions for Firebase - Google
Cloud Functions for Firebase is a serverless framework that lets you automatically run backend code in response to events triggered by Firebase features...
Read more >Importing Data to a Firestore Database
In this lab you will upload existing data (a CSV file) to a Firestore serverless database in the cloud.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

@Timer thx for the quick response. I will try to see with
serverless-next.jsthen. When you mentioned to use the new target, do you meantarget: 'experimental-serverless-trace'?Thanks for this excellent feedback. We’ll take it into account and rework the docs around this.
Regarding your questions above, deployments to ZEIT Now still use our builders (via zero config). Meaning
@now/nextstill runs the show!This is the code that forces the target: https://github.com/zeit/now/blob/master/packages/now-next/src/create-serverless-config.ts
This is the code that wraps the build output for ZEIT Now: https://github.com/zeit/now/blob/master/packages/now-next/src/index.ts