Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

redux-persist-pouchdb doesn't work, Object is undefined #15132

Closed
7 tasks done
patak-dev opened this issue Nov 24, 2023 Discussed in #15131 · 3 comments
Closed
7 tasks done

redux-persist-pouchdb doesn't work, Object is undefined #15132

patak-dev opened this issue Nov 24, 2023 Discussed in #15131 · 3 comments

Comments

@patak-dev
Copy link
Member

Discussed in #15131

Originally posted by mvaldetaro November 23, 2023

Describe the bug

When running a project in development that uses 'redux-persist-pouchdb' and creates an instance of PouchDBStorage, the following error is presented:

inherits_browser.js:6 Uncaught TypeError: Object prototype may only be an Object or null: undefined
at Function.create ()
at inherits2 (inherits_browser.js:6:31)
at ../Fnt/Web/JS/investira.react.ui/node_modules/pouchdb/lib/index-browser.es.js (index-browser.es.js:459:1)
at __init (chunk-AUZ3RYOM.js?v=d979b12c:15:56)
at ../Fnt/Web/JS/investira.react.ui/node_modules/redux-persist-pouchdb/dist/index.js (index.js:8:39)
at __require2 (chunk-AUZ3RYOM.js?v=d979b12c:18:50)
at index.js:55:19

Reproduction

https://stackblitz.com/edit/vitejs-vite-ernlsm?file=src%2FApp.jsx

Steps to reproduce

npm create vite@latest
npm i redux-persist-pouchdb
Add <script>window.global ||= window;</script> in index.html
Add import PouchDBStorage from "redux-persist-pouchdb"; in App.jsx
Creates an instance PouchDBStorage()

System Info

System:
    OS: macOS 12.6.5
    CPU: (4) x64 Intel(R) Core(TM) i7-5557U CPU @ 3.10GHz
    Memory: 67.80 MB / 16.00 GB
    Shell: 5.8.1 - /bin/zsh
  Binaries:
    Node: 18.17.0 - ~/.nvm/versions/node/v18.17.0/bin/node
    Yarn: 1.22.19 - ~/.yarn/bin/yarn
    npm: 9.6.7 - ~/.nvm/versions/node/v18.17.0/bin/npm
    Watchman: 2022.03.21.00 - /usr/local/bin/watchman
  Browsers:
    Chrome: 119.0.6045.159
    Safari: 16.6
  npmPackages:
    @vitejs/plugin-react: ^4.0.3 => 4.1.0 
    vite: ^4.4.5 => 4.5.0

Used Package Manager

npm

Logs

No response

Validations

@patak-dev
Copy link
Member Author

Sorry @mvaldetaro, I misinterpreted the repro setup. Moving it back to an issue.

@mvaldetaro
Copy link

Related Issues:

isaacs/inherits#48

pouchdb/pouchdb#8535

@patak-dev
Copy link
Member Author

It seems that it assumes events is used by default. Installing the events package fixes the repro:
https://stackblitz.com/edit/vitejs-vite-d1pesz?file=vite.config.js,src%2FApp.jsx

It is reproduced directly with pouchdb: https://stackblitz.com/~/edit/vitejs-vite-vpigyp?file=index.html&terminal=dev

@github-actions github-actions bot locked and limited conversation to collaborators Dec 9, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants