-1

I'm trying to set up a Back4App backend in a react native expo 45 app. I keep getting a

[Unhandled promise rejection: ReferenceError: Can't find variable: indexedDB]

warning related to the async-storage and Parse import.

import AsyncStorage from "@react-native-async-storage/async-storage";
const Parse = require("parse/react-native.js");
Parse.setAsyncStorage(AsyncStorage);

The warning points to a function in

node_modules\parse\node_modules\idb-keyval\dist\compat.cjs

function createStore(dbName, storeName) {
  var dbp = safariFix__default['default']().then(function () {
    var request = indexedDB.open(dbName);

    request.onupgradeneeded = function () {
      return request.result.createObjectStore(storeName);
    };

    return promisifyRequest(request);
  });
  return function (txMode, callback) {
    return dbp.then(function (db) {
      return callback(db.transaction(storeName, txMode).objectStore(storeName));
    });
  };
}

I find almost no results with searches so I don't even know where to begin troubleshooting. Am I missing something or can this just be ignored?

Cory
  • 113
  • 9
  • Well. You have `indexedDB.open(dbName);` And the error message says it doesn't know what `indexedDB` is supposed to be. So figure out what it is supposed to be and then you can figure out why it isn't. – Quentin May 26 '22 at 14:53
  • Also consider if the code is *supposed* to run in React Native. https://stackoverflow.com/questions/49947756/does-react-native-support-indexed-db – Quentin May 26 '22 at 14:54
  • Is saying find the problem to fix the problem supposed to be helpful? I didn't write that code, it's the only instance of indexedDB in any of the code, and I've seen that page but the accepted answer is 4 years old. I am following the very detailed Back4App React Native docs so I am inclined to believe it should run in React Native. – Cory May 26 '22 at 15:19

1 Answers1

0

The problem is in Parse@3.4.2

I reverted back to Parse@3.4.0 and all is working again for now.

Cory
  • 113
  • 9