GithubHelp home page GithubHelp logo

Comments (13)

rap2hpoutre avatar rap2hpoutre commented on June 22, 2024 2

Hi @antoniojtorres @djpate @snwfdhmp

We just released a new version of Lumber that adds a DATABASE_REJECT_UNAUTHORIZED parameter in Lumber generated projects (it is set to false by default to ease users onboarding). If you update Lumber to the latest version then start a new project, you should not be annoyed anymore with the SequelizeConnectionError: self-signed certificate message.

If you want to fix your actual project without re-running the install command, add this line to your .env file:

DATABASE_REJECT_UNAUTHORIZED=false

Then edit models/index.js (here):

-  databaseOptions.dialectOptions.ssl = true;
+  if (process.env.DATABASE_REJECT_UNAUTHORIZED === false) {
+    databaseOptions.dialectOptions.ssl = { rejectUnauthorized: false };
+  } else {
+    databaseOptions.dialectOptions.ssl = true;
+  }

A quick note about the chosen implementation: I first created an implementation with a dialectOptions for Lumber, but after some discussion with other members of the team, we finally decided to implement a fix for this need only (the main argument is that we do not need to develop something heavy for problems that are not identified yet).

TL;DR: Issue fixed, update to latest Lumber version.

Thank you for your patience 🙏 Let me know if you have any issue, I would be glad to help you!

from lumber.

rap2hpoutre avatar rap2hpoutre commented on June 22, 2024 1

Hi @antoniojtorres! Thank you for your feedback and this detailed explanation 👍 . I guess we should improve this, I opened an issue on our product board about this need.

from lumber.

snwfdhmp avatar snwfdhmp commented on June 22, 2024 1

Thanks a lot ! You can test if this works with Heroku simply via their free Postgres add-ons

from lumber.

bmewj avatar bmewj commented on June 22, 2024 1

Hey, the fix doesn't work.

The environment variable DATABASE_REJECT_UNAUTHORIZED doesn't automatically get parsed and converted to a boolean, so === false doesn't work.

from lumber.

snwfdhmp avatar snwfdhmp commented on June 22, 2024

Hi, I need this too !

from lumber.

djpate avatar djpate commented on June 22, 2024

Same, I can't use DigitalOcean managed DB because of this.

from lumber.

snwfdhmp avatar snwfdhmp commented on June 22, 2024

I cannot use Heroku managed DB myself because of this.

from lumber.

rap2hpoutre avatar rap2hpoutre commented on June 22, 2024

@snwfdhmp & @djpate Thank you for your feedback. This concern has been reported to the product team which is aware of the issue. This is currently in our roadmap. You will be notified as soon as it has been released!

from lumber.

rap2hpoutre avatar rap2hpoutre commented on June 22, 2024

Related issue here: https://community.forestadmin.com/t/ssl-issues-with-forestadmin/837

(Side note: I'm working on a patch, I hope to release it this week).

from lumber.

snwfdhmp avatar snwfdhmp commented on June 22, 2024

@rap2hpoutre thanks a lot !

from lumber.

rap2hpoutre avatar rap2hpoutre commented on June 22, 2024

@bartjoyce Whoops. Thank you for spotting this, and sorry for the mess. A new PR is on its way!

from lumber.

rap2hpoutre avatar rap2hpoutre commented on June 22, 2024

@bartjoyce It has just been fixed thanks to your comment!

Could you try again with the latest version of lumber? (v3.7.2)


If you want to fix your actual project without re-running the install command, add this line to your .env file:

DATABASE_REJECT_UNAUTHORIZED=false

Then edit models/index.js (here):

-  databaseOptions.dialectOptions.ssl = true;
+ const rejectUnauthorized = process.env.DATABASE_REJECT_UNAUTHORIZED;
+ if (rejectUnauthorized && (JSON.parse(rejectUnauthorized.toLowerCase()) === false)) {
+   databaseOptions.dialectOptions.ssl = { rejectUnauthorized: false };
+ } else {
+   databaseOptions.dialectOptions.ssl = true;
+ }

Let me know if it fixed your issue 🙏

from lumber.

rap2hpoutre avatar rap2hpoutre commented on June 22, 2024

Feel free to re-open if you still have any issues.

from lumber.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.