Parse-SDK-JS
Parse-SDK-JS copied to clipboard
React native SDK error: While trying to resolve module `idb-keyval` from file
New Issue Checklist
- [x] I am not disclosing a vulnerability.
- [x] I am not just asking a question.
- [x] I have searched through existing issues.
- [x] I can reproduce the issue with the latest versions of Parse Server and the Parse JS SDK.
Issue Description
I am suddenly getting an error with the new release of parse and including the old ones too regarding idb-keyval
. I see that the latest release sought to address that bug, however it doesn't seem to go away.
Steps to reproduce
import Server from "parse/react-native.js"; import AsyncStorage from '@react-native-async-storage/async-storage';
Server.setAsyncStorage(AsyncStorage); Server.initialize(Constants.APP_ID, Constants.JAVASCRIPT_KEY); Server.serverURL = Constants.APP_API;
then try run the app in the emulator
Actual Outcome
Check the logs below
Expected Outcome
that the react native build should run as usual following: (import Server from "parse/react-native.js";)
Environment
Node JS 12 on Mac iOS Big sur
Server
- Parse Server version:
5.0.0-beta.4
- Operating system:
Mac OS
- Local or remote host (AWS, Azure, Google Cloud, Heroku, Digital Ocean, etc):
Local
Database
- System (MongoDB or Postgres):
MongoDB
- Database version:
4.2
- Local or remote host (MongoDB Atlas, mLab, AWS, Azure, Google Cloud, etc):
MongoDB Atlas
Client
- Parse JS SDK version:
3.4.1
Logs
iOS Bundling failed 10162ms
While trying to resolve module idb-keyval
from file /node_modules/parse/lib/react-native/IndexedDBStorageController.js
, the package /node_modules/idb-keyval/package.json
was successfully found. However, this package itself specifies a main
module field that could not be resolved (/node_modules/idb-keyval/dist/compat.cjs
. Indeed, none of these files exist:
- /node_modules/idb-keyval/dist/compat.cjs(.native|.ios.ts|.native.ts|.ts|.ios.tsx|.native.tsx|.tsx|.ios.js|.native.js|.js|.ios.jsx|.native.jsx|.jsx|.ios.json|.native.json|.json)
- /node_modules/idb-keyval/dist/compat.cjs/index(.native|.ios.ts|.native.ts|.ts|.ios.tsx|.native.tsx|.tsx|.ios.js|.native.js|.js|.ios.jsx|.native.jsx|.jsx|.ios.json|.native.json|.json)
Thanks for opening this issue!
- 🚀 You can help us to fix this issue faster by opening a pull request with a failing test. See our Contribution Guide for how to make a pull request, or read our New Contributor's Guide if this is your first time contributing.
Does this issue belong to https://github.com/parse-community/parse-react?
Does this issue belong to https://github.com/parse-community/parse-react?
parse/react-native.js is a under parse sdk
I got this same issue since upgrading to 3.4.1, its only a problem when used in a react-native project.
The changelog says:
dist no longer committed.
Maybe that explains the error log:
However, this package itself specifies a main module field that could not be resolved (/node_modules/idb-keyval/dist/compat.cjs. Indeed, none of these files exist:
See this change and the readme.
@zealmurapa I got the same issue recently and have fixed it using this. https://github.com/facebook/metro/issues/535#issuecomment-970443661
If it worked, it should bring you a new error "Can't find variable: indexedDB", which I've opened here.
I am having the same error with expo & typescript and I have no metro config. Do I create a metro.config.ts file or .js file then add support for .cjs and .mjs?
@zealmurapa I got the same issue recently and have fixed it using this. facebook/metro#535 (comment)
If it worked, it should bring you a new error "Can't find variable: indexedDB", which I've opened here.
Have you been able to fix this? I'm having the same errors
@ndukachukz I having the same issue.
Best solution at this time is to use Parse version 3.4.0
Closing via https://github.com/parse-community/Parse-SDK-JS/pull/1569