debugging client.connect()

Hey Matt! Here is the binding config.. The weird thing is that all of the workers are hitting the exact same DB and instance.
hyperdrive = [
{ binding="REWARDS", id="40161c14328e4af193ee63631756f6ab" }
]
hyperdrive = [
{ binding="REWARDS", id="40161c14328e4af193ee63631756f6ab" }
]
I have attached screen shots of the Hyperdrive config.
No description
No description
No description
9 Replies
Paul Shriner
Paul ShrinerOP12mo ago
it appears that client.connect is null, but I don't know why. When I stringify client, I receive a value back, when I try to print client.connect, it is null.
try{
const client = new Client({ connectionString: env.REWARDS.connectionString });
console.log(JSON.stringify(client))
console.log(JSON.stringify(client.connect))

} catch(ex){
console.log(ex)
}
try{
const client = new Client({ connectionString: env.REWARDS.connectionString });
console.log(JSON.stringify(client))
console.log(JSON.stringify(client.connect))

} catch(ex){
console.log(ex)
}
And here are the results from the log.
{
"message": [
"{\"domain\":null,\"_events\":{}, ....}"
],
"level": "log",
"timestamp": 1702043001116
},
{
"message": [
null
],
"level": "log",
"timestamp": 1702043001116
},
{
"message": [
"{\"domain\":null,\"_events\":{}, ....}"
],
"level": "log",
"timestamp": 1702043001116
},
{
"message": [
null
],
"level": "log",
"timestamp": 1702043001116
},
You can see that the client printed out (truncated for space here) but the client.connect method was null.
elithrar
elithrar12mo ago
Can you confirm each of these Workers has the same version of pg? What does package-lock.json have?
Paul Shriner
Paul ShrinerOP12mo ago
All are referencing 8.11.3
elithrar
elithrar12mo ago
You can't typically print functions like client.connect - that's not really a way to test. To confirm: 1. You have three Workers all connecting to the same Hyperdrive configuration 2. The third Worker does not work 3. By "does not work" - you call client.connect() and it fails silently Does it throw an exception? Nothing at all?
Paul Shriner
Paul ShrinerOP12mo ago
I have been able to print client.connect in the past. It is a sniff test. I have not tested it the other workers in this case. 1. Yes all are connecting to the same 2. The third worker does not work. 3. I call client.connect and it fails silently
elithrar
elithrar12mo ago
Can you share the account ID, script-id and the code for the "broken" Worker?
Paul Shriner
Paul ShrinerOP12mo ago
AccountID: e909090c243c668f1acf40bdeefbe04d ScriptID: linkprocessing Nevermind, apparently by stripping everything out of the worker it started working.
sigh.... Sorry for wasting your time.
elithrar
elithrar12mo ago
Curious: do you know what you stripped out that made it work? Was there code before client.connect - ?
Paul Shriner
Paul ShrinerOP12mo ago
I had some link library code, both stuff I wrote and code that was imported. So no, but let me see if I can recreate the conditions.
Want results from more Discord servers?
Add your server