Parse-SDK-JS icon indicating copy to clipboard operation
Parse-SDK-JS copied to clipboard

React native SDK error: While trying to resolve module `idb-keyval` from file

Open zealmurapa opened this issue 3 years ago • 9 comments

New Issue Checklist

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)

zealmurapa avatar Jan 12 '22 23:01 zealmurapa

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?

mtrezza avatar Jan 13 '22 00:01 mtrezza

Does this issue belong to https://github.com/parse-community/parse-react?

parse/react-native.js is a under parse sdk

zealmurapa avatar Jan 13 '22 10:01 zealmurapa

I got this same issue since upgrading to 3.4.1, its only a problem when used in a react-native project.

stage88 avatar Jan 16 '22 02:01 stage88

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.

mtrezza avatar Jan 16 '22 11:01 mtrezza

@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.

chillaxdev avatar Jan 16 '22 12:01 chillaxdev

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?

ndukachukz avatar Jan 18 '22 17:01 ndukachukz

@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 avatar Jan 19 '22 18:01 ndukachukz

@ndukachukz I having the same issue. Best solution at this time is to use Parse version 3.4.0

anhtuank7c avatar Feb 06 '22 15:02 anhtuank7c

Closing via https://github.com/parse-community/Parse-SDK-JS/pull/1569

dplewis avatar Jan 27 '23 20:01 dplewis