1

My Node.js API service is hosted on google cloud App Engine running in a standard environment. I have followed all the steps but the following message is being thrown by the debug agent:

@google-cloud/debug-agent Failed to re-register debuggee xxx-backend: Error: The file at { does not exist, or it is not a file. ENOENT: no such file or directory, lstat '/workspace/{'

I have this code at the top of my app.ts file: require('@google-cloud/debug-agent').start();

My Node.js version is: 14.17.0

After updating the package and installing it again the error is:

Error: The file at { does not exist, or it is not a file. ENOENT: no such file or directory, lstat '/workspace/{' at Object.realpathSync (fs.js:1796:7) at GoogleAuth._getApplicationCredentialsFromFilePath (/workspace/node_modules/google-auth-library/build/src/auth/googleauth.js:263:27) at GoogleAuth._tryGetApplicationCredentialsFromEnvironmentVariable (/workspace/node_modules/google-auth-library/build/src/auth/googleauth.js:206:25) at GoogleAuth.getApplicationDefaultAsync (/workspace/node_modules/google-auth-library/build/src/auth/googleauth.js:136:24) at GoogleAuth.getClient (/workspace/node_modules/google-auth-library/build/src/auth/googleauth.js:551:28) at GrpcClient._getCredentials (/workspace/node_modules/@google-cloud/logging/node_modules/google-gax/build/src/grpc.js:145:40) at GrpcClient.createStub (/workspace/node_modules/@google-cloud/logging/node_modules/google-gax/build/src/grpc.js:308:34) at processTicksAndRejections (internal/process/task_queues.js:95:5)
4

2 回答 2

1

The environment variable GOOGLE_APPLICATION_CREDENTIALS is used to provide authentication credentials to your application code.

The Stackdriver Debugger Agent should work without manually provided authentication credentials for instances running on Google Cloud Platform, if the Stackdriver Debugger API access scope is enabled on that instance. For Google App Engine instances, this is automatic if the Debugger API has been enabled for your project (which is the default). If you are running elsewhere such as locally, on-premise, or on another cloud provider, you need to manually provide credentials. For more information refer to the documentation.

You were setting the env variable GOOGLE_APPLICATION_CREDENTIALS to the file “{” that’s why you were getting an error.

Looks like you are running the code on Google Cloud Platform that's the reason your code is working even after deleting the env variable GOOGLE_APPLICATION_CREDENTIALS.

于 2021-07-09T12:25:21.070 回答
0

Okay, so I got the answer by trying out some stuff. Basically, I had GOOGLE_APPLICATION_CREDENTIALS in my secrets. My application is deployed in GAE so I don't need the credentials. I was using another application for hosting before so I had it in my secrets. Once I removed that secret it started to work.

But why did this error occur? The credentials were correct so it should have worked anyway right?

于 2021-07-05T12:57:57.433 回答