Heroku application stopped serving db2 connection - node.js

I have my app hosted on heroku for nearly 1 year, and in the past 24 hours, it stopped working. I get this in my logs:
2021-11-08T18:15:06.475815+00:00 app[web.1]: [Error: [IBM][CLI Driver] SQL30081N A communication error has been detected. Communication protocol being used: "TCP/IP". Communication API being used: "SOCKETS". Location where the error was detected: "". Communication function detecting the error: "selectForConnectTimeout". Protocol specific error code(s): "115", "*", "*". SQLSTATE=08001
2021-11-08T18:15:06.475827+00:00 app[web.1]: ] {
2021-11-08T18:15:06.475828+00:00 app[web.1]: error: '[node-ibm_db] SQL_ERROR',
2021-11-08T18:15:06.475829+00:00 app[web.1]: sqlcode: -30081,
2021-11-08T18:15:06.475829+00:00 app[web.1]: state: '08001'
2021-11-08T18:15:06.475830+00:00 app[web.1]: }
2021-11-08T18:15:33.386490+00:00 heroku[router]: at=error code=H12 desc="Request timeout" method=POST path="/login" host=www.mysite.ca request_id=3d627300-28d2-48af-a86e-60bdb950298a fwd="99.249.30.56" dyno=web.1 connect=0ms service=30000ms status=503 bytes=0 protocol=https
It seems to not like whatever is going on with db2. I can access my database no problem through my local machine, and see everything with in my db tables. I also have this directly from my heroku dashboard.
i am not able to figure out what the issue is. does anyone have any ideas?

Thanks to everyone for their answers. I did some more digging around, and turns out what solved it was reinstalling the db2 driver locally, and pushing it to heroku. Something must have changed that required an update to the db2 driver to connect with the heroku sevrer.

Related

How to fix not found error with heroku deployment / no such file or directory

First, sorry for my poor English.
The problem is this.
Whenever I try to open heroku I get this screen:
Not Found
Whenever I try to heroku logs I get this screen:
2022-05-20T09:26:03.000000+00:00 app[api]: Build succeeded
...
2022-05-20T09:26:08.430002+00:00 app[web.1]: MongoDB database connection established successfully
...
2022-05-20T09:32:21.525922+00:00 heroku[router]: at=info method=GET path="/" host=protected-wildwood-11173.herokuapp.com request_id=f33e9e00-7573-4fa5-9ebf-7e9c54d04532 fwd="121.134.103.64" dyno=web.1 connect=0ms service=2ms status=404 bytes=412 protocol=https
2022-05-20T09:32:21.526199+00:00 app[web.1]: Error: ENOENT: no such file or directory, stat '/app/client/build/index.html'
And this is my codes
package.json
folder path
server.js
In my expectation
Heroku cannot cognize 'build'
wrong path ( server.js - deployment )
I haven't been able to do it for 7 days.
Please help me
crycrycry...

Getting Error when refreshing my react app

My app is working fine until i try to referesh the page. I made the build version of the frontend and then pasted all the contents in the public folder of node js backend. Everything is working just fine until i do a refresh.
I find a similar problem : Heroku Deployed App, Page Refresh error or Redirecting error
The only difference is i am getting this error: Failed to load resource: the server responded with a status of 404 (Not Found).
I did heroku logs and found this:
2021-01-29T20:31:35.136038+00:00 app[web.1]: GET /posts/myNewsFeed 304
377.308 ms - - 2021-01-29T20:31:35.137763+00:00 heroku[router]: at=info method=GET path="/posts/myNewsFeed"
host=insta-clone-01.herokuapp.com
request_id=d0dfee79-74f4-43c2-9ce5-7df121136872 fwd="1.38.45.193"
dyno=web.1 connect=0ms service=383ms status=304 bytes=181
protocol=https
2021-01-29T20:31:37.519726+00:00 heroku[router]: at=info method=GET
path="/home" host=insta-clone-01.herokuapp.com
request_id=d0a7784f-bcbe-41ed-88de-43e71cd364c7 fwd="1.38.45.193"
dyno=web.1 connect=0ms service=3ms status=404 bytes=400 protocol=https
2021-01-29T20:31:37.520005+00:00 app[web.1]: GET /home 404 1.326 ms -
160
These are the logs for the same page but the first is when i normally get to the page and the second one is when i refresh the page.
what i can say from this is when i am normally trying to get to a page the request is happening to the /posts/myNewsFeed which is my node api endpoint but when i am refreshing the same page the request is happening to /home which is my route for the page ,not the node api endpoint and that's why i am getting the error.
You can see the project here https://github.com/Aditya-shrivastav/InstagramClone
Anyone who can give a solution for this?

Heroku nodejs can not post data

I have a simple nodejs api, which connected to mongodb on mlab.
On local I can use GET, POST methods. But after I deployed to Heroku:
I only GET data.
POST method returns 400 bad request. And if I use heroku logs -t I can't see log about post method.
I searched related keywords: heroku -nodejs- post method 400 bad request, they don't work with my case.
This is my log after I use postman send GET and POST requests.
2020-04-01T16:58:02.831314+00:00 app[web.1]: tiny wiz running // my console.log
2020-04-01T16:58:03.131550+00:00 heroku[web.1]: State changed from starting to up
2020-04-01T16:58:03.259355+00:00 app[web.1]: (node:23) DeprecationWarning: collection.ensureIndex is deprecated. Use createIndexes instead.
2020-04-01T16:58:27.099916+00:00 heroku[router]: at=info method=GET path="/" host=MYAPP_URL request_id=a5f384ad-b857-4356-a4de-f8148cfd2e16 fwd="publicIP" dyno=web.1 connect=1ms service=100ms status=200 bytes=1016 protocol=https
2020-04-01T16:58:27.094337+00:00 app[web.1]: GET METHOD HERE!!! // my console.log
▸ Log stream timed out. Please try again.
As you can see, It has no log about POST method.
Pls let's me know if you has any infomation about my environment.
Thank in advance!

H12 request timeout on grapheneDB Neo4j connection

Needless to say I am new to both Heroku and GrapheneDB. I have a Nodejs app using Neo4j that runs fine on my local machine. I moved it to Heroku and used GrapheneDB to connect the neo4j DB to the app. When I run the app on Heroku I get a H12 Request timeout when I try to login which require the database access. The only change in my code is the following recommended by GrapheneDB:
var graphenedbURL = process.env.GRAPHENEDB_BOLT_URL;
var graphenedbUser = process.env.GRAPHENEDB_BOLT_USER;
var graphenedbPass = process.env.GRAPHENEDB_BOLT_PASSWORD;
var driver = neo4j.driver(graphenedbURL, neo4j.auth.basic(graphenedbUser, graphenedbPass));
//var driver = neo4j.driver("bolt://localhost", neo4j.auth.basic("neo4j", "xxxxx"));
where I added the first four lines and commented out the fifth line.
The non-DB functions of the app works fine but any attempt to connect to the db result in a H12. I am using Javascript with Neo4j 3.0.8 and papertail for logging. The following is the papertail log when I tried to register a user:
Feb 09 18:53:44 puppydog-dev-2017 heroku/router: at=error code=H12 desc="Request timeout" method=POST path="/users/registerowner" host=puppydog-dev-2017.herokuapp.com request_id=867c7bc5-2d61-4c82-8b42-87732b21d449 fwd="104.244.227.83" dyno=web.1 connect=1ms service=30000ms status=503 bytes=0
Can anyone shed some light on whats happening here?
I discovered that the H12 is as a result of the DB being shutdown by a reset from the GrapheneDb platform. All subsequent calls to the DB result in H12 since the DB is not available. The original problem that cause the DB to shutdown is still unknown.

Password authentication failing for ghost blog on heroku server

I'm trying to setup Ghost(node.js blogging app) to run on a heroku server. I've followed this tutorial here but I'm getting an Application error when I load the app URL. Looking at the logs, I'm getting the following stack trace:
2016-12-16T10:00:08.185701+00:00 heroku[web.1]: Starting process with command `NODE_ENV=production node index.js`
2016-12-16T10:00:11.989635+00:00 app[web.1]:
2016-12-16T10:00:11.989655+00:00 app[web.1]: ERROR: password authentication failed for user "xxxxxxxxxxxxxx"
2016-12-16T10:00:11.989656+00:00 app[web.1]: error: password authentication failed for user "xxxxxxxxxxxxxx"
2016-12-16T10:00:11.989656+00:00 app[web.1]:
2016-12-16T10:00:11.989658+00:00 app[web.1]: at Connection.parseMessage (/app/node_modules/pg/lib/connection.js:361:17)
2016-12-16T10:00:11.989657+00:00 app[web.1]: at Connection.parseE (/app/node_modules/pg/lib/connection.js:534:11)
2016-12-16T10:00:11.989659+00:00 app[web.1]: at TLSSocket.<anonymous> (/app/node_modules/pg/lib/connection.js:105:22)
2016-12-16T10:00:11.989660+00:00 app[web.1]: at emitOne (events.js:96:13)
2016-12-16T10:00:11.989661+00:00 app[web.1]: at readableAddChunk (_stream_readable.js:176:18)
2016-12-16T10:00:11.989662+00:00 app[web.1]: at TLSSocket.Readable.push (_stream_readable.js:134:10)
2016-12-16T10:00:11.989660+00:00 app[web.1]: at TLSSocket.emit (events.js:188:7)
2016-12-16T10:00:11.989663+00:00 app[web.1]: at TLSWrap.onread (net.js:548:20)
2016-12-16T10:00:11.989664+00:00 app[web.1]:
2016-12-16T10:00:12.059675+00:00 heroku[web.1]: Process exited with status 0
2016-12-16T10:00:12.098899+00:00 heroku[web.1]: State changed from starting to crashed
2016-12-16T10:00:11.574238+00:00 app[web.1]: WARNING: Ghost is attempting to use a direct method to send email.
2016-12-16T10:00:11.574254+00:00 app[web.1]: It is recommended that you explicitly configure an email service.
2016-12-16T10:00:11.575112+00:00 app[web.1]: Help and documentation can be found at http://support.ghost.org/mail.
2016-12-16T10:00:11.575114+00:00 app[web.1]:
2016-12-16T12:20:59.497399+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=ai-blog.herokuapp.com request_id=a725a350-ade1-4f00-9b8a-125fac34eb23 fwd="82.46.0.56" dyno= connect= service= status=503 bytes=
2016-12-16T12:21:01.504908+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=ai-blog.herokuapp.com request_id=cc0c4f9b-f3af-4867-942f-0c7f295f9b90 fwd="82.46.0.56" dyno= connect= service= status=503 bytes=
2016-12-16T12:21:03.381794+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=ai-blog.herokuapp.com request_id=ee190254-0159-4ba0-aa74-6e58f661c966 fwd="82.46.0.56" dyno= connect= service= status=503 bytes=
It seems that the important part of the error here is that the password is failing: But I've double and tripled check the all of the heroku varibles are set correctly, i.e. no typos, no extra spaces added at the start end of the string.
Additionally, the app runs fine locally.
The issue seems relatively common, but I've tried most of the solutions from other posts and nothing seems to be resolving the issue.
Solutions that I've tried:
Checked all varibles for typos
Checked the correct database is promoted
Manually adding the user credendials to the remote database(For some reason I can still access the remote database through the command line)
Ran the following command heroku config:set PGSSLMODE=require
ensured that I'm using https in the url when connecting to the site through a browser
I've added the following to the db params in the production environment of my config.js ssl: true
I've also checked that I'm in production environment
Sugguestions that I haven't tried:
Someone suggested that node needs to be updated. But I can't see any way of updating whatever version of node it is that heroku uses.
Somone suggested that postgres needs to be updated. But I can't see any way of updating that on heroku servers either. However, I did update the version number in the package.json file from 4.1.1 to 4.5.5 and moved it from optionalDependencies to dependencies.
editing the pg_hba.conf - again, I imagine this file exists on heroku servers and I can't access it
Anyone got any ideas?
I encounter the same problem while trying to upgrade to Ghost version 0.11.3 and deploying to Heroku.
I was able to solve the problem by upgrading the PostgreSQL npm package.
In package.json:
{
"dependencies": {
"pg": "^4.5.5",
},
"optionalDependencies": {
"pg": "^4.5.5"
}
}
And you will also need to modify the npm-shrinkwrap.json file:
{
"dependencies": {
"pg": {
"version": "^4.5.5",
"from": "pg#4.5.5",
"resolved": "https://registry.npmjs.org/pg/-/pg-4.5.5.tgz",
"dependencies": {...}
}
}
}
After that, check that the PG npm package version was updated correctly by taking a look at Heroku's deploy log. It should say something like:
remote: -----> Build succeeded!
remote: ├── ...
remote: ├── pg#4.5.5
remote: ├── ...

Resources