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)
  • That message usually means the package is not installed. Confirm you installed it and it shows up in your package.json – NoCommandLine Jul 05 '21 at 02:18
  • @NoCommandLine Thankyou for the response! It was already present but I installed it again now the error is more clear but still don't know how to fix it. I have updated the error message on the post. – Absolute-nil Jul 05 '21 at 12:30

2 Answers2

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.

  • Yes, I am using GCP app engine. Thank you for your response. how was the GOOGLE_APPLICATION_CREDENTIAL env variable was set to file "{"? And if it was set to the right file then it would not have thrown the issue? (also what is the right file then?) – Absolute-nil Jul 10 '21 at 13:23
  • 1
    In the code somewhere you are setting the file "{". Check your code where you are setting that file. You said that your code is working after deleting that env variable. So I assumed that through that env variable you are setting that file. To authenticate an application follow the [documentation](https://cloud.google.com/docs/authentication/production). – Chandra Kiran Pasumarti Jul 12 '21 at 19:06
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?