Open ntalamdotcom opened 1 year ago
bind EADDRINUSE null:3000
It seems you are using @google-cloud/local-auth
, which is pretty much a sample code to show how to implement OAuth2. After logging in, your browser gets redirected to https://localhost:3000, which is the port that local-auth
will listen on.
Since @google-cloud/local-auth
is a sample package, it does not have any way to change the port it listens on. You might just copy the code - it's just one file - to your project, and use a different port there, other than 3000.
bind EADDRINUSE null:3000
It seems you are using
@google-cloud/local-auth
, which is pretty much a sample code to show how to implement OAuth2. After logging in, your browser gets redirected to https://localhost:3000, which is the port thatlocal-auth
will listen on.Since
@google-cloud/local-auth
is a sample package, it does not have any way to change the port it listens on. You might just copy the code - it's just one file - to your project, and use a different port there, other than 3000.
Hi Alexander, thank you for your fast reply.
After copying and pasting the block of code you suggested me: 1.- I have changed the port. 2.- I had a problem reading the json credentials file. I had too turn in it into a relative path.
To understand more how to use this, please guide me with this...
I got an error when running this on Windows10:
error - uncaughtException: Error: spawn undefined\System32\WindowsPowerShell\v1.0\powershell ENOENT at ChildProcess._handle.onexit (node:internal/child_process:286:19) at onErrorNT (node:internal/child_process:484:16) at process.processTicksAndRejections (node:internal/process/task_queues:82:21) { errno: -4058, code: 'ENOENT', syscall: 'spawn undefined\\System32\\WindowsPowerShell\\v1.0\\powershell', path: 'undefined\\System32\\WindowsPowerShell\\v1.0\\powershell',
Then, when running it on Debian Linux, whatever is the script asking to be execute, runs properly. However it hangs when asking for the confirmation from the url https://accounts.google.com/o/oauth2/v2/auth?redirect_uri...
re: hangs when asking for confirmation from the URL - it is supposed to open the browser to open that accounts.google.com URL, and then be redirected to your local port (which will pass the authentication code from accounts.google.com to your code). It might not work if you run it over ssh, you need to be able to open browser in the place where it's run.
As for the Windows error, apparently it tries to run Powershell from the wrong path spawn undefined\System32\WindowsPowerShell\v1.0\powershell
- note the undefined
part where it should say C:
or something. I don't have a Windows machine nearby to try that, but some googling shows issues like https://github.com/vitest-dev/vitest/issues/1870. I would assume it's not us, but something with Node.js and child_process
on Windows maybe? There are some tricks in that issue such as making sure the powershell.exe
is in your PATH
, or things like that. Mind trying to figure that out?
1) Is this a client library issue or a product issue? My nextJS has a default port configuration, however...
When executing the following code in NextJS, I get "bind EADDRINUSE null:3000" error:
`/**
*/ export async function authorize() { var client = await loadSavedCredentialsIfExist(); if (client) { console.info("client found") return client; } else { console.info("client not found") console.info("CREDENTIALS_PATH: ", CREDENTIALS_PATH) console.info("SCOPES: ", SCOPES) var clientNew = null
if (await fs.existsSync(CREDENTIALS_PATH)) { console.info("CREDENTIALS file exist") } else { console.info("CREDENTIALS file DOES NOT exist") throw new Error("Credentials file does not exist"); }
try { console.info("SystemRoot: ", process.env.SystemRoot) // console.info("CREDENTIALS_PATH: ", CREDENTIALS_PATH) // console.info("SCOPES: ", SCOPES) clientNew = await authenticate({ scopes: SCOPES, keyfilePath: CREDENTIALS_PATH, }); } catch (error) { console.info(JSON.stringify(error)) throw new Error("damn it"); }
console.info("clientNew generated") if (clientNew && clientNew.credentials) { await saveCredentials(clientNew); }
return clientNew; } }`
2) Did someone already solve this? No one. a couples of days wasted.
3) Do you have a support contract? I do not
googleapis
version: "@google-cloud/local-auth": "^2.1.0", "@googleapis/calendar": "^3.0.0",Steps to reproduce
My packages:
Thanks!