Closed crunchytoast closed 2 years ago
I'm not familiar with Firebase. Can you give me step by step instructions. I don't know what an 'expo project' is.
ok I'm sorry, I'll write out the full details to recreate this issue...
expo is just a helper to make react-native apps, and firebase is a popular no-sql database hosting service
npm install --global expo-cli
then clone the repo I just shared with you called testfirebase
to start, you run expo install
,
then expo start
It should show the error...
I have a hunch it's more of a firebase error... since they had stopped using idb as a dependency, then just recently started using it again and have run into this issue. So I'm not sure which part of the equation has changed.
Yeah, I think so. Can you file an issue with them and link to it here?
https://github.com/firebase/firebase-js-sdk/issues/6253
Here's a link to an existing issue there, where people are suggesting it's a problem with metro recognizing .cjs files. Seems to be an error merry-go-round...
If this is the case, the metro is working on a fix, and has a PR already in the works...
Same issue
If you want a workaround, you can either downgrade your firebase version for now... or add a cjs reference in your metro.config file @SohelIslamImran
@crunchytoast Thank you. Resolved.
Create a metro.config.js file in the project root. In the file add the file extension cjs
. details
const { getDefaultConfig } = require("@expo/metro-config");
const defaultConfig = getDefaultConfig(__dirname);
defaultConfig.resolver.assetExts.push("cjs");
module.exports = defaultConfig;
Adding the cjs reference in metro.config.js DID NOT WORK for me. Still receiving the same failed to resolve idb error. I tried all variations of it with sourceExt and still didn't work.
If adding the cjs reference doesn't work, then just roll back firebase
npm uninstall firebase
npm install firebase@9.6.11
This isn't an idb issue... it's an error in the metro bundler not recognizing cjs files, combined with idb being added as a dependency for the latest firebase version.
Resolved! Thank you. I keep forgetting that version of Firebase exists.
On Thu, May 19, 2022, 10:46 AM crunchytoast @.***> wrote:
This isn't an idb issue... it's an error in the metro bundler not recognizing cjs files, combined with idb being added as a dependency for the latest firebase version.
— Reply to this email directly, view it on GitHub https://github.com/jakearchibald/idb/issues/267#issuecomment-1131891818, or unsubscribe https://github.com/notifications/unsubscribe-auth/AMSPZ5U6HV5YA4ENAYOHJ4LVKZO63ANCNFSM5VQRLKLA . You are receiving this because you commented.Message ID: @.***>
Just commenting here for folks that may still run into the same issue as I do:
Error thrown when reading from storage. Original error: (0 , _idb.openDB) is not a function. (app/storage-get).
https://github.com/firebase/firebase-js-sdk/issues/6253#issuecomment-1159733409
ok I'm sorry, I'll write out the full details to recreate this issue...
expo is just a helper to make react-native apps, and firebase is a popular no-sql database hosting service
npm install --global expo-cli
then clone the repo I just shared with you called testfirebase
to start, you run expo install, then expo start
It should show the error...
On Tue, May 10, 2022 at 4:09 PM Jake Archibald @.***> wrote:
I'm not familiar with Firebase. Can you give me step by step instructions. I don't know what an 'expo project' is.
— Reply to this email directly, view it on GitHub https://github.com/jakearchibald/idb/issues/267#issuecomment-1122068197, or unsubscribe https://github.com/notifications/unsubscribe-auth/AQWXFYLVS6TDCHWRELUCSNLVJIKU7ANCNFSM5VQRLKLA . You are receiving this because you authored the thread.Message ID: @.***>
Android Bundling failed 4326ms While trying to resolve module
idbfrom file
D:###\node_modules\@firebase\app\dist\esm\index.esm2017.js, the package
D:###\node_modules\idb\package.jsonwas successfully found. However, this package itself specifies a
mainmodule field that could not be resolved (
D:###\node_modules\idb\build\index.cjs. Indeed, none of these files exist:
To reproduce, initialize an expo project, npm install the latest firebase version, and import any module from firebase in the App.js file.