# MaxListenersExceededWarning

**URL:** <https://community.parseplatform.org/t/maxlistenersexceededwarning/1054>\
**Category:** Cloud Code\
**Created:** [November 23, 2020, 3:23pm UTC](https://community.parseplatform.org/t/maxlistenersexceededwarning/1054 "2020-11-23T15:23:14Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![CastAsHuman](https://community.parseplatform.org/user_avatar/community.parseplatform.org/castashuman/32/239_2.png) [@CastAsHuman](https://community.parseplatform.org/u/CastAsHuman)\
**Post date:** [November 23, 2020, 3:23pm UTC](https://community.parseplatform.org/t/maxlistenersexceededwarning/1054/1 "2020-11-23T15:23:14Z")

</div>

Any idea why this is logged?

`(node:17983) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 connect listeners added. Use emitter.setMaxListeners() to increase limit`

I’m on `2.8.4`

---

<div class="post-metadata">

**Author:** ![davimacedo](https://community.parseplatform.org/user_avatar/community.parseplatform.org/davimacedo/32/316_2.png) [@davimacedo](https://community.parseplatform.org/u/davimacedo)\
**Post date:** [November 23, 2020, 3:48pm UTC](https://community.parseplatform.org/t/maxlistenersexceededwarning/1054/2 "2020-11-23T15:48:17Z")

</div>

Is it on the client or server?

---

<div class="post-metadata">

**Author:** ![CastAsHuman](https://community.parseplatform.org/user_avatar/community.parseplatform.org/castashuman/32/239_2.png) [@CastAsHuman](https://community.parseplatform.org/u/CastAsHuman)\
**Post date:** [November 23, 2020, 4:35pm UTC](https://community.parseplatform.org/t/maxlistenersexceededwarning/1054/3 "2020-11-23T16:35:47Z")

</div>

It’s logged on the server

---

<div class="post-metadata">

**Author:** ![davimacedo](https://community.parseplatform.org/user_avatar/community.parseplatform.org/davimacedo/32/316_2.png) [@davimacedo](https://community.parseplatform.org/u/davimacedo)\
**Post date:** [November 23, 2020, 8:46pm UTC](https://community.parseplatform.org/t/maxlistenersexceededwarning/1054/4 "2020-11-23T20:46:50Z")

</div>

It is a node.js warning that happens when you have multiple handlers being added to the same event. Anything special in your parse server setup? Maybe the way you are mounting parse server on the express.js application? or maybe cloud code or live query?

---

<div class="post-metadata">

**Author:** ![CastAsHuman](https://community.parseplatform.org/user_avatar/community.parseplatform.org/castashuman/32/239_2.png) [@CastAsHuman](https://community.parseplatform.org/u/CastAsHuman)\
**Post date:** [November 25, 2020, 9:39pm UTC](https://community.parseplatform.org/t/maxlistenersexceededwarning/1054/5 "2020-11-25T21:39:36Z")

</div>

What is a handler?

Here’s my `index.js` file:

> var express = require(‘express’);  
> var ParseServer = require(‘parse-server’).ParseServer;  
> var ParseDashboard = require(‘parse-dashboard’);  
> var allowInsecureHTTP = true;  
> var path = require(‘path’);  
> var S3Adapter = require(‘parse-server’).S3Adapter;  
> var AWS = require(“aws-sdk”);
> 
> var databaseUri = process.env.DATABASE\_URI || process.env.MONGODB\_URI;
> 
> if (!databaseUri) {  
> console.log(‘DATABASE\_URI not specified, falling back to localhost.’);  
> }
> 
> process.env.NODE\_TLS\_REJECT\_UNAUTHORIZED = ‘0’;
> 
> //Set Digital Ocean Spaces EndPoint  
> const spacesEndpoint = new AWS.Endpoint(‘’);  
> //Define S3 options  
> var s3Options = {  
> bucket: ‘’,  
> baseUrl: ‘’,  
> region: ‘fra1’,  
> directAccess: true,  
> globalCacheControl: “public, max-age=31536000”,  
> s3overrides: {  
> accessKeyId: ‘’,  
> secretAccessKey: ‘’,  
> endpoint: spacesEndpoint  
> }  
> };
> 
> var s3Adapter = new S3Adapter(s3Options);
> 
> var api = new ParseServer({  
> databaseURI: databaseUri,  
> cloud: ‘cloud-code-repository/main.js’,  
> appId: process.env.APP\_ID,  
> allowClientClassCreation: false,  
> masterKey: process.env.MASTER\_KEY,  
> fileKey: ‘’,  
> filesAdapter: s3Adapter,  
> serverURL: process.env.SERVER\_URL || ‘[http://ip:1337/parse](http://ip:1337/parse)’,  
> logLevel: ‘notice’,  
> expireInactiveSessions: false,
> 
> push: {  
> ios: {  
> pfx: path.join(\_\_dirname, ‘./certificates/PushCertificate.p12’),  
> topic: ‘’,  
> production: true  
> }  
> },
> 
> verifyUserEmails: false,
> 
> publicServerURL: ‘[http://ip:1337/parse](http://ip:1337/parse)’,
> 
> // The email adapter  
> emailAdapter: {  
> module: ‘@parse/simple-mailgun-adapter’,  
> options: {  
> // The address that your emails come from  
> fromAddress: ‘no-answer@nup.com’,  
> // Your domain from [mailgun.com](http://mailgun.com)  
> domain: ‘’,  
> // Your API key from [mailgun.com](http://mailgun.com)  
> apiKey: ‘’,  
> }  
> }  
> });
> 
> var app = express();
> 
> // Serve static assets from the /public folder  
> app.use(‘/public’, express.static(path.join(\_\_dirname, ‘/public’)));
> 
> // Serve the Parse API on the /parse URL prefix  
> var mountPath = process.env.PARSE\_MOUNT || ‘/parse’;  
> app.use(mountPath, api);
> 
> // Parse Server plays nicely with the rest of your web routes  
> app.get(‘/’, function(req, res) {  
> res.status(200).send(‘Make sure to star the parse-server repo on GitHub!’);  
> });
> 
> app.get(“/recordingFile/:name/”, function(request, response) {  
> response.sendFile(path.join(\_\_dirname, “…/recordingFiles/”) + request.params.name, (error) =\> {  
> if (error)  
> response.status(400).send({ message: “Error” });  
> });  
> });
> 
> var port = process.env.PORT || 1337;  
> var httpServer = require(‘http’).createServer(app);  
> httpServer.listen(port, function() {  
> console.log('parse-server-example running on port ’ + port + ‘.’);  
> });
> 
> // Set up parse dashboard
> 
> var dashboardConfig = {  
> “allowInsecureHTTP”: true,  
> “apps”: [  
> {  
> “serverURL”: “[http://ip:1337/parse](http://ip:1337/parse)”,  
> “appId”: “”,  
> “masterKey”: “”,  
> “appName”: " “,  
> “production”: true  
> }  
> ],“users”: [  
> {  
> “user”:”“,  
> “pass”:”"  
> }  
> ]  
> };
> 
> var dashboard = new ParseDashboard(dashboardConfig, {  
> allowInsecureHTTP: dashboardConfig.allowInsecureHTTP  
> });  
> var dashApp = express();
> 
> // make the Parse Dashboard available at /dashboard  
> dashApp.use(‘/dashboard’, dashboard);
> 
> // Parse Server plays nicely with the rest of your web routes  
> dashApp.get(‘/’, function(req, res) {  
> res.status(200).send(‘Parse Dashboard App’);  
> });
> 
> var httpServerDash = require(‘http’).createServer(dashApp);  
> httpServerDash.listen(4040, function() {  
> console.log(‘dashboard-server running on port 4040.’);  
> });

---

<div class="post-metadata">

**Author:** ![davimacedo](https://community.parseplatform.org/user_avatar/community.parseplatform.org/davimacedo/32/316_2.png) [@davimacedo](https://community.parseplatform.org/u/davimacedo)\
**Post date:** [November 25, 2020, 10:05pm UTC](https://community.parseplatform.org/t/maxlistenersexceededwarning/1054/6 "2020-11-25T22:05:58Z")

</div>

It is probably something in your cloud code. Something like the following if called multiple times (I think the default node setting for this is 10) could fire this warning:

```auto
Parse.LiveQuery.on('error', (error) => {
  console.log(error);
});

```

---

<div class="post-metadata">

**Author:** ![Moumouls](https://community.parseplatform.org/user_avatar/community.parseplatform.org/moumouls/32/332_2.png) [@Moumouls](https://community.parseplatform.org/u/Moumouls)\
**Post date:** [December 18, 2020, 2:05pm UTC](https://community.parseplatform.org/t/maxlistenersexceededwarning/1054/7 "2020-12-18T14:05:12Z")

</div>

I found something but not sure if it’s related: [https://github.com/parse-community/parse-server/pull/7083](https://github.com/parse-community/parse-server/pull/7083)

---

<div class="post-metadata">

**Author:** ![CastAsHuman](https://community.parseplatform.org/user_avatar/community.parseplatform.org/castashuman/32/239_2.png) [@CastAsHuman](https://community.parseplatform.org/u/CastAsHuman)\
**Post date:** [December 18, 2020, 2:21pm UTC](https://community.parseplatform.org/t/maxlistenersexceededwarning/1054/8 "2020-12-18T14:21:34Z")

</div>

Unfortunately no. I don’t have LiveQuery enabled.

---

<div class="post-metadata">

**Author:** ![Moumouls](https://community.parseplatform.org/user_avatar/community.parseplatform.org/moumouls/32/332_2.png) [@Moumouls](https://community.parseplatform.org/u/Moumouls)\
**Post date:** [December 18, 2020, 2:24pm UTC](https://community.parseplatform.org/t/maxlistenersexceededwarning/1054/9 "2020-12-18T14:24:37Z")

</div>

since you mentioned that you are on version 2.8, this is an old version; an update may fix it 🙂
