Is it possible to turn off security features for a Heroku Postgres database?

My project doesn't involve sensitive data, so I'm not concerned about security vulnerabilities.

I believe the issue lies in the connection between the App/server and the DB. I've searched on Youtube and Google for solutions, but the information I found was outdated or ineffective. However, connecting to the database using heroku psql (cli) or pgAdmin4 with the database credentials works perfectly fine.

Following this tutorial by

https://github.com/ousecTic/pern-deploy-tutorial

Errors:

const pool = new Pool({
    connectionString: process.env.DATABASE_URL,
    ssl: true,
});
------------------------------------------------------------------------
2022-02-12T11:02:33.058860+00:00 heroku[web.1]: State changed from starting to up
2022-02-12T11:02:34.275213+00:00 app[web.1]: node:internal/process/promises:265
2022-02-12T11:02:34.275240+00:00 app[web.1]: triggerUncaughtException(err, true /* fromPromise */);
2022-02-12T11:02:34.275241+00:00 app[web.1]: ^
2022-02-12T11:02:34.275241+00:00 app[web.1]: 
2022-02-12T11:02:34.275241+00:00 app[web.1]: Error: self signed certificate
2022-02-12T11:02:34.275242+00:00 app[web.1]: at TLSSocket.onConnectSecure (node:_tls_wrap:1530:34)
2022-02-12T11:02:34.275242+00:00 app[web.1]: at TLSSocket.emit (node:events:520:28)
2022-02-12T11:02:34.275242+00:00 app[web.1]: at TLSSocket._finishInit (node:_tls_wrap:944:8)
2022-02-12T11:02:34.275243+00:00 app[web.1]: at TLSWrap.ssl.onhandshakedone (node:_tls_wrap:725:12) {
2022-02-12T11:02:34.275243+00:00 app[web.1]: code: 'DEPTH_ZERO_SELF_SIGNED_CERT'
2022-02-12T11:02:34.275243+00:00 app[web.1]: }
-------------------------------------------------------------------------

const pool = new Pool({
  connectionString: process.env.DATABASE_URL,
});
------------------------------------------------------------------------------------
2022-02-12T11:19:13.660398+00:00 app[web.1]: { description: 'jhoipjo' } <<console.log() 
2022-02-12T11:19:13.681933+00:00 app[web.1]: no pg_hba.conf entry for host "3.86.151.70", user "user", database "database", SSL off
------------------------------------------------------------------------------------

const pool = new Pool({
    connectionString: process.env.DATABASE_URL,
    ssl: false,
});
------------------------------------------------------------------------------------

2022-02-12T11:58:50.711988+00:00 app[web.1]: /app/node_modules/pg-protocol/dist/parser.js:287
2022-02-12T11:58:50.712007+00:00 app[web.1]: const message = name === 'notice' ? new messages_1.NoticeMessage(length, messageValue) : new messages_1.DatabaseError(messageValue, length, name);
2022-02-12T11:58:50.712008+00:00 app[web.1]: ^
2022-02-12T11:58:50.712009+00:00 app[web.1]: 
2022-02-12T11:58:50.712010+00:00 app[web.1]: error: no pg_hba.conf entry for host "3.236.98.211", user "user", database "database", SSL off
2022-02-12T11:58:50.712010+00:00 app[web.1]: at Parser.parseErrorMessage (/app/node_modules/pg-protocol/dist/parser.js:287:98)
2022-02-12T11:58:50.712011+00:00 app[web.1]: at Parser.handlePacket (/app/node_modules/pg-protocol/dist/parser.js:126:29)
2022-02-12T11:58:50.712012+00:00 app[web.1]: at Parser.parse (/app/node_modules/pg-protocol/dist/parser.js:39:38)
2022-02-12T11:58:50.712013+00:00 app[web.1]: at Socket.<anonymous> (/app/node_modules/pg-protocol/dist/index.js:11:42)
2022-02-12T11:58:50.712014+00:00 app[web.1]: at Socket.emit (node:events:520:28)
2022-02-12T11:58:50.712015+00:00 app[web.1]: at addChunk (node:internal/streams/readable:315:12)
2022-02-12T11:58:50.712015+00:00 app[web.1]: at readableAddChunk (node:internal/streams/readable:289:9)
2022-02-12T11:58:50.712016+00:00 app[web.1]: at TCP.onStreamRead (node:internal/stream_base_commons:190:23) {
2022-02-12T11:58:50.712019+00:00 app[web.1]: file: 'auth.c',
2022-02-12T11:58:50.712020+00:00 app[web.1]: line: '496',
2022-02-12T11:58:50.712021+00:00 app[web.1]: routine: 'ClientAuthentication'
2022-02-12T11:58:50.712022+00:00 app[web.1]: }
------------------------------------------------------------------------------------

Answer №1

The application in question was a blogging platform built using Node.js, which inherently included security features.

const pool = new Pool({
    connectionString: process.env.DATABASE_URL,
   
         ssl: {
        rejectUnauthorized: false,
    },
   
});

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

HTML5 Boilerplate and optimizing the critical rendering path by deferring scripts and styles

Previously, I constructed my website layouts using the HTML5 Boilerplate method: incorporating styles and Modernizr in the head section, jQuery (either from Google CDN or as a hosted file) along with scripts just before the closing body tag. This is an exa ...

Tips for passing a timestamp to a Postgresql DB using a Button in a Form instead of a traditional rails time_select box

I am currently developing a CAD App in Rails 4 with Ruby 2. The goal is to provide users with a button on the screen to log an on-scene time and clear scene time, especially since most users will be using touch screen computers. Instead of using the defaul ...

VUE JS - My methods are triggering without any explicit invocation from my side

I've encountered a frustrating problem with Vue JS >.<. My methods are being triggered unexpectedly. I have a button that is supposed to execute a specific method, but this method gets executed along with other methods, causing annoyance... Her ...

JavaScript functions smoothly on Google Chrome but is restricted on Internet Explorer

Experimenting with the code found on this website to conduct some testing. The javascript functions smoothly in Google Chrome and Firefox, but encounters issues in IE. Interestingly, when I run the html file in IE locally, it does work, but a warning pops ...

Exploring Next.js dynamic imports using object destructuring

import { UDFCompatibleDatafeed } from "./datafeeds/udf/src/udf-compatible-datafeed.js"; I'm facing a challenge in converting the above import to a dynamic import in Next.js. My attempt was as follows: const UDFCompatibleDatafeed = dynamic(( ...

What could be causing the server to not successfully receive the ajax request?

I need to conduct integration tests on a website that routes all requests through a proxy: var express = require("express"), http = require("http"), port = (process.env.PORT || 8001), server = module.exports = express(), httpProxy = requir ...

Deactivate web security for JavaScript with Watir

While using Watir, I have the ability to access the methods of the iframes on the page: browser.iframes.map(&:contentwindow) # => ["", "", ""] However, if I try to access the iframes using JavaScript within the same context where I executed the W ...

What could be the reason for the Azure server sending a Bad Request response?

My NodeJS application is currently hosted on Azure server and all APIs are functioning correctly, providing the expected responses. The issue arises when trying to run a GET API like the following: https://demoapp.azurewebsites.net/mymenu?userId=piyush.d ...

Tips for updating Vuex getter value during Vue testing?

I'm working on a simple test scenario where I have the following code: describe('App', () => { let store; beforeEach(() => { store = new Vuex.Store({ modules: { auth: { n ...

Using environment variables in next.config.js allows for successful connection to the database, however, when attempting to use a

Utilizing the serverless-mysql library, I have successfully connected my next app to a remote MySQL DB through an SSH tunnel with the ssh2 library. Although everything is functioning properly, I am looking to enhance the security of my code by removing the ...

Retrieving data from the database without the need to reload the page

Hi there! I have a PHP script that fetches data from a database and I want to display this data within a div element with a "link" class without having to reload the page. Check out the code snippet below: <? include('config.php'); $rs = m ...

Ingress - Access denied

Even though I have gone through tons of similar issues, I still can't seem to figure out the solution... :/ To clarify, I am not using minikube, but rather kubernetes docker desktop. I have a basic express.js server set up like this: app.get('/ ...

ReactJS - Travel Booking Platform with Advanced Date and Price Filtering

Currently, I am in the process of developing a project — a website similar to AirBnB or Booking.com for booking rooms. The backend is built on Java Spring, while the frontend uses ReactJs. Although most of the code runs smoothly, I'm encountering s ...

Refreshing the browser does not load the Angular2 component and instead shows a 404 error

During my exploration of Angular 2, I developed a basic restaurant management application. Now, I am delving into more advanced techniques such as creating an app bundle, minification, and optimizing the application. The authentication component in my app ...

Using Vue.js to detect changes in a value and dynamically highlight the text

I am working on a simple script that generates random numbers every few moments. I want to change the background color whenever the random number is not equal to the one before it. Is this possible? For example, if the random numbers generated are 1, 1, an ...

The Angular module instantiation failed with the error message: "[$injector:modulerr] Failed to

Struggling with setting up basic AngularJS functionality for a project, especially when trying to include angular-route. Both components are version 1.4.8. My approach involves using gulp-require to concatenate my JS files. Here is my main javascript file: ...

Tips on enlarging the header size in ion-action-sheet within the VueJS framework of Ionic

Recently I started using Vue along with the ionic framework. This is a snippet of code from my application: <ion-action-sheet :is-open="isActionSheetOpen" header="Choose Payment" mode="ios" :buttons="buttons&qu ...

Ways to add a line break within JavaScript code

I am currently developing a bot for my Discord server and working on logging messages to a text file. All the necessary information about the message is stored in a variable named logger, and I am using Node.js to append my log file. When attempting to ad ...

Error: Attempting to access 'input_date' property of null object resulted in an uncaught type error

I am attempting to implement pagination for a data table using AJAX to refresh the table without having to reload the entire page. However, I am encountering an issue where the input_date is being considered null even though it should not be. Below is the ...

Having an issue with the pop state function not functioning correctly

I am facing an issue with my images where clicking on a specific image changes the URL to that ID. However, I can only go back once and then the same URL is repeated every time I press the back button. Additionally, the forward button does not work at all. ...