Can't retrieve data from Firestore when `swcMinify: true`
See original GitHub issueWhat version of Next.js are you using?
12.0.3
What version of Node.js are you using?
14
What browser are you using?
Chrome
What operating system are you using?
Linux
How are you deploying your application?
Vercel
Describe the Bug
I’m using Firebase version 9.4.1. I can’t get the data by running a query to my Firebase Firestore. This only happens when in production and I enable swcMinify
in the next.config.js
file.
So, to fix it I just disable the swcMinify
feature and everything is back to normal.
Expected Behavior
Get data from my Firebase Firestore.
To Reproduce
I took just one example that I got from the official Firebase(version 9) documentation to retrieve all data from collections: https://firebase.google.com/docs/firestore/query-data/get-data#get_all_documents_in_a_collection. Then I added a bit of how I implemented it:
useEffect(() => {
getUser(auth.id, user => {
setUser(user)
})
}, [auth])
In the next.config.js
file we enable the swcMinify
feature.
module.exports = {
swcMinify: true
// ....
}
Then, you can try running it in production with next build
then next start
.
Issue Analytics
- State:
- Created 2 years ago
- Reactions:2
- Comments:6 (2 by maintainers)
Top Results From Across the Web
Can't retrieve data from Firestore - Stack Overflow
The method says that no data exists at the Firestore reference; I have tried "googling" the problem and can't find the solution.
Read more >Get data with Cloud Firestore - Firebase
There are three ways to retrieve data stored in Cloud Firestore. Any of these methods can be used with documents, collections of documents,...
Read more >How to Structure Your Data | Get to know Cloud Firestore #5
It's important to get your Cloud Firestore data structure in order. Knowing when to use Maps, ... Your browser can't play this video....
Read more >No success with Firestore .data access at get() path
get (/databases/$(database)/documents/rules2/$(ruleId)).data.visible == true; ... of an error in get(), "in" statement or not existing field... can't tell, ...
Read more >Next.js and Firebase DB full-stack app tutorial | LogRocket Blog
Like Firestore's Realtime Database, Cloud Firestore is free and allows developers to store, edit, and sync data at a global scale for mobile ......
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 FreeTop 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
Top GitHub Comments
I confirm that this issue has been resolved in
12.0.9-canary.4
. Thanks for all the hard work 🙏I’m facing the exact same issue, Firestore stops functioning when deployed to Vercel with swcMinify turned on