You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We had an error using deno with the npm package @google-cloud/cloud-sql-connector were we got an exception telling us that the public key was missing as an argument. That led to a longer debug session and us trying to find out how the library is creating public&private keys, which it is doing here https://github.com/GoogleCloudPlatform/cloud-sql-nodejs-connector/blob/main/src/crypto.ts#L73 using a promisified version of generateKeyPair().
According to the documentation it's fine and should work in both node and deno. But actually in deno privateKey and publicKey are undefined. This led us to more debugging on the internals of promisify. Normally the given callback style function would just get one argument for error and one for success, but generateKeyPair() is actually returning two arguments, which would get converted to an object, but in our case it's returning the first of those, which is the public key and not as an object.
The issue is that the customPromisifyArgs symbol is not defined on generateKeyPair() and therefore promisify fails to correctly convert the result to an object. What would be needed IMHO is defining the arguments as it's done with dns lookup() here
Version: Deno 2.0.6
We had an error using deno with the npm package @google-cloud/cloud-sql-connector were we got an exception telling us that the public key was missing as an argument. That led to a longer debug session and us trying to find out how the library is creating public&private keys, which it is doing here https://github.com/GoogleCloudPlatform/cloud-sql-nodejs-connector/blob/main/src/crypto.ts#L73 using a promisified version of
generateKeyPair()
.According to the documentation it's fine and should work in both node and deno. But actually in deno
privateKey
andpublicKey
areundefined
. This led us to more debugging on the internals ofpromisify
. Normally the given callback style function would just get one argument for error and one for success, butgenerateKeyPair()
is actually returning two arguments, which would get converted to an object, but in our case it's returning the first of those, which is the public key and not as an object.The issue is that the
customPromisifyArgs
symbol is not defined on generateKeyPair() and thereforepromisify
fails to correctly convert the result to an object. What would be needed IMHO is defining the arguments as it's done with dnslookup()
heredeno/ext/node/polyfills/dns.ts
Line 287 in cff6e28
Code to replicate:
more or less taken from https://docs.deno.com/api/node/crypto/~/generateKeyPair
With deno 2.0.6
asyncResult
is just a string with the public key.callbackArgs
is an array like[null, publicKey, privateKey]
With nodejs
asyncResult
is an object {publicKey, privateKey}, whilecallbackArgs
is the same as with deno.Sidenote: giving credit to @sb-ma who spotted it first.
The text was updated successfully, but these errors were encountered: