Closed
Description
New Issue Checklist
- I am not disclosing a vulnerability.
- I am not just asking a question.
- I have searched through existing issues.
- I can reproduce the issue with the latest versions of Parse Server and the Parse JS SDK.
Issue Description
In a web context where window.indexedDB
is protected from use but not undefined, Parse SDK throws an error on initial import. For example, in a Figma Plugin web context, window.indexedDB
API is defined, but once an indexedDB API function is called an error is thrown:
Uncaught DOMException: Failed to execute 'open' on 'IDBFactory': access to the Indexed Database API is denied in this context.
Parse is an initializing an indexedDB store in this file, to store at top level property Parse.IndexDB
, even if the user never sets the Parse storage controller to indexedDB.
3 fix options immediately come to mind:
- Wrap line linked above in try/catch, and set
Parse.IndexedDB
to undefined if it throws - Don't initialize
Parse.IndexedDB
store by default, since it isn't used by default. - Remove IndexedDBStorageController from Parse SDK to a plugin module, or example file. It would also clean up the unused
idb-keyval
dependency.
Steps to reproduce
Create a figma plugin and import the Parse library:
import Parse from 'parse/dist/parse.min.js' // error thrown
Actual Outcome
Parse cannot be imported.
Expected Outcome
Parse can be imported.
Environment
Server
- Parse Server version:
n/a
- Operating system:
n/a
- Local or remote host (AWS, Azure, Google Cloud, Heroku, Digital Ocean, etc):
n/a
Database
- System (MongoDB or Postgres):
n/a
- Database version:
n/a
- Local or remote host (MongoDB Atlas, mLab, AWS, Azure, Google Cloud, etc):
n/a
Client
- Parse JS SDK version:
4.2.0