Skip to content

Parse error in vite ( back4app ) on Parse.initialize: EventEmitter is not a constructor #2181

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

Closed
4 tasks done
sorooshjaberi opened this issue Jun 22, 2024 · 2 comments
Closed
4 tasks done
Labels
state:duplicate Duplicate of already reported issue type:question Support or code-level question

Comments

@sorooshjaberi
Copy link

sorooshjaberi commented Jun 22, 2024

New Issue Checklist

Issue Description

When calling Parse.initialize with the proper arguments in my vite react application, I get this error: EventEmitter is not a constructor

This is the corresponding code:
parse-code

Steps to reproduce

  1. Create a vite app ( mine was a react-ts one )
  2. Try to initialize parse SDK in the app
  3. You will get the error below

Actual Outcome

parse-error

Expected Outcome

No errors

Workaround

Install the events package pnpm install events

Environment

Server

  • Operating system: Ubuntu 23.10
  • Local or remote host (AWS, Azure, Google Cloud, Heroku, Digital Ocean, etc): Local

Database

  • System (MongoDB or Postgres): MongoDB
  • Local or remote host (MongoDB Atlas, mLab, AWS, Azure, Google Cloud, etc): back4app

Client

  • Parse JS SDK version: 5.1.0

Logs

Copy link

parse-github-assistant bot commented Jun 22, 2024

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.

@dplewis
Copy link
Member

dplewis commented Jun 22, 2024

Duplicate #1766

You need to polyfill the event emitter.

We could replace the node event emitter with a custom isomorphic event emitter.

@mtrezza mtrezza added type:question Support or code-level question state:duplicate Duplicate of already reported issue labels Jun 22, 2024
@mtrezza mtrezza closed this as completed Jun 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
state:duplicate Duplicate of already reported issue type:question Support or code-level question
Projects
None yet
Development

No branches or pull requests

3 participants