Git Product home page Git Product logo

Comments (2)

Venryx avatar Venryx commented on June 15, 2024

Actually, I found that the postgraphile client has a similar issue of being unable to connect, until postgraphile and a couple other packages are updated.

Therefore, rather than updating pg directly (and adding it to the dependency list), I found that the connection issue can be resolved (both for the frontend and backend), by updating these packages:

yarn add @graphile-contrib/[email protected]
yarn add @graphile/[email protected]
yarn add [email protected]
yarn add [email protected]

However, once these packages are updated, I found that it requires that your database password be supplied (in the connection string, or as an environment variable), otherwise you get this error (for both the client and the random.js script):

internal/crypto/keys.js:324
[pg]     throw new ERR_INVALID_ARG_TYPE(
[pg]     ^
[pg]
[pg] TypeError [ERR_INVALID_ARG_TYPE]: The "key" argument must be of type string or an instance of Buffer, TypedArray, DataView, or KeyObject. Received null
[pg]     at prepareSecretKey (internal/crypto/keys.js:324:11)
[pg]     at new Hmac (internal/crypto/hash.js:111:9)
[pg]     at Object.createHmac (crypto.js:143:10)
[pg]     at createHMAC (C:\Root\Apps\@V\@Modules\graphile-engine\LiveQueryBug\Attempt2\node_modules\pg\lib\sasl.js:133:17)
[pg]     at Hi (C:\Root\Apps\@V\@Modules\graphile-engine\LiveQueryBug\Attempt2\node_modules\pg\lib\sasl.js:137:13)
[pg]     at Object.continueSession (C:\Root\Apps\@V\@Modules\graphile-engine\LiveQueryBug\Attempt2\node_modules\pg\lib\sasl.js:32:24)
[pg]     at Client._handleAuthSASLContinue (C:\Root\Apps\@V\@Modules\graphile-engine\LiveQueryBug\Attempt2\node_modules\pg\lib\client.js:257:10)
[pg]     at Connection.emit (events.js:314:20)
[pg]     at C:\Root\Apps\@V\@Modules\graphile-engine\LiveQueryBug\Attempt2\node_modules\pg\lib\connection.js:115:12
[pg]     at Parser.parse (C:\Root\Apps\@V\@Modules\graphile-engine\LiveQueryBug\Attempt2\node_modules\pg-protocol\dist\parser.js:40:17) {
[pg]   code: 'ERR_INVALID_ARG_TYPE'
[pg] }

You can see the issue described here:
brianc/node-postgres#2371
feathersjs-ecosystem/generator-feathers#607
mikro-orm/mikro-orm#866

I fixed it by supplying the database password, using an environment variable (and then opening a new shell):

PGPASSWORD=YOUR_DB_PASSWORD

In summary, two changes need to be made for the demo to work in Node 14.5+:

  1. Update the four packages, as shown at the top of this post. (to restore compatibility with latest Node's stream module)
  2. Add instructions to the readme about how the database password must be supplied, by setting the PGPASSWORD environment variable.

Would one or both of these changes be acceptable as a pull request? Or is there a different solution available/preferred?

(I'm very new to Postgraphile, and am just trying to get this live-query demo working for now, so I can evaluate its flexibility and such. With the changes above, I've managed to get the data loading on the demo page. However, the live-queries appear to not be updating; so my next task is figuring out what's wrong with the live-query system. EDIT: The live-query issue was just due to me compiling the wal2json.dll file incorrectly. With the changes above, the demo works fully now. 😃)

from livesotope.

benjie avatar benjie commented on June 15, 2024

Hey 👋 Yes updating the dependencies would be very welcome as a single PR; you should be able to do this by deleting yarn.lock, running yarn again, and then pushing the updated yarn.lock as a PR.

As for the key issue, I think this might be related to your setup? I've not experienced that issue on Mac or Linux. I'm guessing you can fix it by using a subtly modified (e.g. more explicit) connection string? I'm not sure if that makes sense as a PR - it's been a while since I've been in the guts of this project - feel free to raise one if it's minimal effort and we'll go from there 👍

Thanks 🙌

from livesotope.

Related Issues (2)

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.