question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Can't retrieve data from Firestore when `swcMinify: true`

See original GitHub issue

What 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:closed
  • Created 2 years ago
  • Reactions:2
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
kalwabedcommented, Jan 21, 2022

I confirm that this issue has been resolved in 12.0.9-canary.4. Thanks for all the hard work 🙏

1reaction
PatrikTheDevcommented, Nov 14, 2021

I’m facing the exact same issue, Firestore stops functioning when deployed to Vercel with swcMinify turned on

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found