Closed bzkdjc closed 5 years ago
They are not sandboxed. Will see what's wrong soon. Thanks.
I just tried your sample here and it works for me well.
I just tried your sample here and it works for me well.
Wow! What kind of problem could I have then?
Any idea? Any solution for me to try?
Just tried on my side => same problem; same result.
Still looking for a solution. Will update as soon as I find something relevant.
A wild guess is that the console log is not printed to the console? Just check the devtools, or the devtools console of the background page. In fact, I tried your code snippet by including them in a html file and point package.json to it.
I had to activate debug
mode on "knex.js" in order to see Timeout Error.
The most bizarre part of this issue is that elsewhere (e.g. electron) it works!
1-line to fetch one record from Postgres using knex ORM:
new Utilisateur({login: 'dan'}).fetch().then(d=>{console.log(d)}).catch(e=>{console.error(e)})
On NW.js (DevTools)
On Electron (Developer Tools)
Do you see?
There's a timeout while attempting to acquire connection when using NWjs, while the connection is immediately acquired when using Electron where, after some debug output, we get what was console.log
'ed at last.
=> I thought it was a 'knex' bug until I tried the same folder of code under Electron.
The same happens when using bookshelf
or pg
npm modules.
Could you upload a full sample app? (Not copy/paste in devtools). In this way we can rule out some factors.
It's a large project started 4 years ago under "node-webkit". Everything has always been fine 'til that issue. I'm going to look for which part to extract for upload.
Here is my test which passes here:
package.json:
{
"name": "nw-demo",
"main": "index.html"
}
index.html:
<script>
const { Pool, Client } = require('pg')
const client = new Client({
user: 'postgres',
host: '127.0.0.1',
database: 'postgres',
password: '',
port: 5432,
})
client.connect()
client.query('SELECT NOW()', (err, res) => {
console.log('err'+ err)
console.log('res'+ res)
client.end()
})
</script>
close until more information is available.
NWJS Version : 0.34.3 SDK (whitelisted on firewall, so has full access to entire network) Operating System : Windows 10 x64 1809
Expected behavior
bookshelf
.pg.js
.Actual behavior
All these modules stay on infinite attempt to connect until
TimeoutException
. None of them passes theconnecting
step.How to reproduce
On a fresh install of NW.js v0.34.3 SDK on Windows 10 x64 1809:
trust
topg_hba.conf
for all users on all DBs on host127.0.0.1/32
and give it full access to local net)nw.exe
, but before: show the Dev Tools window inindex.html
on a script tag inside the body tag, like this:const client = new Client({ user: 'postgres', host: '127.0.0.1', database: 'postgres', password: '', port: 5432, })
client.connect()
client.query('SELECT NOW()', (err, res) => { console.log('err', err) console.log('res', res) client.end() })