Skip to content

Commit 9fc8139

Browse files
committed
updated modules and addressed a pg client issue
- updated to the latest modules - fixed an issue encountered with the pg module described here: brianc/node-postgres#2009 (comment)
1 parent f30cae0 commit 9fc8139

File tree

3 files changed

+43
-17
lines changed

3 files changed

+43
-17
lines changed
+11-11
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "nodejs-graphql",
3-
"version": "0.1.0",
3+
"version": "0.1.1",
44
"main": "./build/index.js",
55
"repository": "https://github.com/IBM-Cloud/vpc-tutorials.git",
66
"author": "IBM",
@@ -11,10 +11,10 @@
1111
"start": "node build/index.js"
1212
},
1313
"dependencies": {
14-
"@babel/runtime": "^7.12.13",
14+
"@babel/runtime": "^7.14.0",
1515
"axios": "^0.21.1",
1616
"body-parser": "^1.19.0",
17-
"chalk": "^4.1.0",
17+
"chalk": "^4.1.1",
1818
"compression": "^1.7.4",
1919
"cookie-parser": "^1.4.5",
2020
"cookie-session": "^1.4.0",
@@ -24,22 +24,22 @@
2424
"express-session": "^1.17.1",
2525
"fs-extra": "^9.1.0",
2626
"graphql": "^15.5.0",
27-
"ibm-cos-sdk": "^1.9.0",
27+
"ibm-cos-sdk": "^1.10.0",
2828
"moment": "^2.29.1",
2929
"morgan": "^1.10.0",
30-
"pg": "^8.5.1",
30+
"pg": "^8.6.0",
3131
"uuid": "^8.3.2",
3232
"winston": "^3.3.3",
33-
"winston-daily-rotate-file": "^4.5.0"
33+
"winston-daily-rotate-file": "^4.5.5"
3434
},
3535
"devDependencies": {
36-
"@babel/cli": "^7.12.13",
37-
"@babel/core": "^7.12.13",
38-
"@babel/plugin-transform-runtime": "^7.12.15",
39-
"@babel/preset-env": "^7.12.13",
36+
"@babel/cli": "^7.13.16",
37+
"@babel/core": "^7.14.2",
38+
"@babel/plugin-transform-runtime": "^7.14.2",
39+
"@babel/preset-env": "^7.14.2",
4040
"rimraf": "^3.0.2"
4141
},
4242
"prefixes": {
4343
"cookiesPrefix": "vpc:"
4444
}
45-
}
45+
}

sampleapps/nodejs-graphql/src/createTables.js

+16-3
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,24 @@ const credentials = pg_credentials[0].credentials;
1010
(async function createTables() {
1111
let postgresconn = credentials.connection.postgres;
1212

13+
// Connection String is failing starting in pg 8.5.x: https://github.com/brianc/node-postgres/issues/2009#issuecomment-753211352
14+
// let database_config = {
15+
// connectionString: postgresconn.composed[0],
16+
// ssl: {
17+
// ca: Buffer.from(postgresconn.certificate.certificate_base64, 'base64').toString()
18+
// }
19+
// };
20+
1321
let database_config = {
14-
connectionString: postgresconn.composed[0],
22+
user: postgresconn.authentication.username,
23+
host: postgresconn.hosts[0].hostname,
24+
database: postgresconn.database,
25+
password: postgresconn.authentication.password,
26+
port: postgresconn.hosts[0].port,
1527
ssl: {
16-
ca: Buffer.from(postgresconn.certificate.certificate_base64, 'base64').toString()
17-
}
28+
rejectUnauthorized: true,
29+
ca: Buffer.from(postgresconn.certificate.certificate_base64, 'base64').toString(),
30+
},
1831
};
1932

2033
// Create a pool.

sampleapps/nodejs-graphql/src/index.js

+16-3
Original file line numberDiff line numberDiff line change
@@ -73,11 +73,24 @@ app.use(
7373
}
7474

7575
let postgresconn = pg_credentials[0].credentials.connection.postgres;
76+
// Connection String is failing starting in pg 8.5.x: https://github.com/brianc/node-postgres/issues/2009#issuecomment-753211352
77+
// let database_config = {
78+
// connectionString: postgresconn.composed[0],
79+
// ssl: {
80+
// ca: Buffer.from(postgresconn.certificate.certificate_base64, 'base64').toString()
81+
// }
82+
// };
83+
7684
let database_config = {
77-
connectionString: postgresconn.composed[0],
85+
user: postgresconn.authentication.username,
86+
host: postgresconn.hosts[0].hostname,
87+
database: postgresconn.database,
88+
password: postgresconn.authentication.password,
89+
port: postgresconn.hosts[0].port,
7890
ssl: {
79-
ca: Buffer.from(postgresconn.certificate.certificate_base64, 'base64').toString()
80-
}
91+
rejectUnauthorized: true,
92+
ca: Buffer.from(postgresconn.certificate.certificate_base64, 'base64').toString(),
93+
},
8194
};
8295

8396
// Create a pool.

0 commit comments

Comments
 (0)