Rocket.chat: UnhandledPromiseRejection - unable to open cert.pem

Created on 28 Apr 2019  路  16Comments  路  Source: RocketChat/Rocket.Chat

Description:

Steps to reproduce:

  1. systemctl start rocketchat

Expected behavior:

server runs normally.

Actual behavior:

Apr 28 17:01:49 chat rocketchat[24548]: { Error: ENOENT: no such file or directory, open 'cert.pem' errno: -2, code: 'ENOENT', syscall: 'open', path: 'cert.pem' }
Apr 28 17:01:49 chat rocketchat[24548]: Exiting due to an unhandled promise rejection

Server Setup Information:

  • Version of Rocket.Chat Server: 1.0.0 60f1a4afd6d91094b86a47576de1a8a15356029b
  • Operating System: ubuntu 16.04
  • Deployment Method: manual
  • Number of Running Instances: 1
  • DB Replicaset Oplog: Enabled
  • NodeJS Version: 8.15.1
  • MongoDB Version: 3.6.12

Additional context

Relevant logs:


oauth / sso bug

All 16 comments

Is there any more logs associated with this?

Apr 28 17:01:10 chat systemd[1]: Started The Rocket.Chat server.
Apr 28 17:01:11 chat systemd-resolved[651]: Server returned error NXDOMAIN, mitigating potential DNS violation DVE-2018-0001, retrying transaction with reduced feature level UDP.
Apr 28 17:01:24 chat rocketchat[24548]: LocalStore: store created at
Apr 28 17:01:24 chat rocketchat[24548]: message repeated 2 times: [ LocalStore: store created at]
Apr 28 17:01:24 chat rocketchat[24548]: Setting default file store to GridFS
Apr 28 17:01:25 chat rocketchat[24548]: Warning: connect.session() MemoryStore is not
Apr 28 17:01:25 chat rocketchat[24548]: designed for a production environment, as it will leak
Apr 28 17:01:25 chat rocketchat[24548]: memory, and will not scale past a single process.
Apr 28 17:01:33 chat rocketchat[24548]: {"line":"121","file":"migrations.js","message":"Migrations: Migrating from version 141 -> 143","time":{"$date":1556438493142},"level":"info"}
Apr 28 17:01:33 chat rocketchat[24548]: {"line":"121","file":"migrations.js","message":"Migrations: Running up() on version 142","time":{"$date":1556438493146},"level":"info"}
Apr 28 17:01:33 chat rocketchat[24548]: {"line":"121","file":"migrations.js","message":"Migrations: Running up() on version 143","time":{"$date":1556438493203},"level":"info"}
Apr 28 17:01:33 chat rocketchat[24548]: {"line":"121","file":"migrations.js","message":"Migrations: Finished migrating.","time":{"$date":1556438493213},"level":"info"}
Apr 28 17:01:43 chat rocketchat[24548]: #033[33mNot migrating, control is locked. Attempt 1/30. Trying again in 10 seconds.#033[39m
Apr 28 17:01:43 chat rocketchat[24548]: {"line":"121","file":"migrations.js","message":"Migrations: Not migrating, already at version 143","time":{"$date":1556438503221},"level":"info"}
Apr 28 17:01:44 chat rocketchat[24548]: Updating process.env.MAIL_URL
Apr 28 17:01:44 chat rocketchat[24548]: #033[32mUsing GridFS for custom sounds storage#033[39m
Apr 28 17:01:44 chat rocketchat[24548]: #033[32mUsing GridFS for custom emoji storage#033[39m
Apr 28 17:01:49 chat rocketchat[24548]: { Error: ENOENT: no such file or directory, open 'cert.pem' errno: -2, code: 'ENOENT', syscall: 'open', path: 'cert.pem' }
Apr 28 17:01:49 chat rocketchat[24548]: Exiting due to an unhandled promise rejection
Apr 28 17:01:49 chat systemd[1]: rocketchat.service: Main process exited, code=exited, status=1/FAILURE
Apr 28 17:01:49 chat systemd[1]: rocketchat.service: Failed with result 'exit-code'.

Here is a full log of syslog.

@jungeonkim are you using something that requires/allows SSL like SAML, LDAP, etc?

FWIW, we updated to 1.0.0 initially and were getting this error, which would kill everything. Updating to 1.0.1 seems to still produce the error, but not kill everything.

@rodrigok I do not use SAML, LDAP, etc. I did a little debugging. This seems to be related to the rocketchat_push module. I do not use push gateway and I uploaded the APN certificate to the admin page.

@jungeonkim if you upgrade to 1.0.1 this error will stop exiting the process, but please check your certificates since the error means something is wrong.

@rodorgas After upgrading to 1.0.1, the server will not crash, but an error message will still be logged.
I found a way to reproduce the problem in a clean installation environment.

  1. https://rocket.chat/docs/installation/manual-installation/
    Follow the document to complete the installation.
  2. On the Push tab of the Administration tab, change "Enable Gateway" to "False" and set "APN Key" and "APN Cert".
  3. systemctl restart rocketchat.service
  4. The error log is displayed.

It still occurs in v1.1.1.

var feedbackOptions = {
'batchFeedback': true,

            // Time in SECONDS
            'interval': 5,
            production: !options.apn.development,
            cert: options.apn.certData,
            key: options.apn.keyData,
            passphrase: options.apn.passphrase
        };

var feedbackOptions = {
'batchFeedback': true,

            // Time in SECONDS
            'interval': 5,
            production: !options.apn.development,
            cert: options.apn.certData,
            key: options.apn.keyData,
            passphrase: options.apn.passphrase
        };

Very thanks for your help !!!

Version 3.1.1 in Docker, still present that bug on container start.

[Error: ENOENT: no such file or directory, open 'cert.pem'] {
  errno: -2,
  code: 'ENOENT',
  syscall: 'open',
  path: 'cert.pem'
}
---------------------------------
Errors like this can cause oplog processing errors.
Setting EXIT_UNHANDLEDPROMISEREJECTION will cause the process to exit allowing your service to automatically restart the process
Future node.js versions will automatically exit the process
=================================

https://github.com/RocketChat/push/pull/4 do we need to apply this change now that we no longer use raix? @rodrigok @sampaiodiego

I guess so @geekgonecrazy .. thanks for pointing it out

oh, we actually don't even use https://github.com/RocketChat/push anymore.. so definitely https://github.com/RocketChat/push/pull/4 is not the fix we need if the issue is still happening, it should be something else.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

karlprieb picture karlprieb  路  3Comments

ghost picture ghost  路  3Comments

zeigerpuppy picture zeigerpuppy  路  3Comments

Buzzele picture Buzzele  路  3Comments

royalaid picture royalaid  路  3Comments