question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

PERMISSION_DENIED: The caller does not have permission

See original GitHub issue

Hy there! How are you?

I’m developing a Google Cloud Function and it is great! But since last week I’m getting an issue testing locally with functions-framework-nodejs

Unhandled rejection
Error: 7 PERMISSION_DENIED: The caller does not have permission
    at Object.callErrorFromStatus (/home/user/project/node_modules/@grpc/grpc-js/build/src/call.js:31:26)
    at Object.onReceiveStatus (/home/user/project/node_modules/@grpc/grpc-js/build/src/client.js:176:52)
    at Object.onReceiveStatus (/home/user/project/node_modules/@grpc/grpc-js/build/src/client-interceptors.js:342:141)
    at Object.onReceiveStatus (/home/user/project/node_modules/@grpc/grpc-js/build/src/client-interceptors.js:305:181)
    at Http2CallStream.outputStatus (/home/user/project/node_modules/@grpc/grpc-js/build/src/call-stream.js:117:74)
    at Http2CallStream.maybeOutputStatus (/home/user/project/node_modules/@grpc/grpc-js/build/src/call-stream.js:156:22)
    at Http2CallStream.endCall (/home/user/project/node_modules/@grpc/grpc-js/build/src/call-stream.js:142:18)
    at Http2CallStream.handleTrailers (/home/user/project/node_modules/@grpc/grpc-js/build/src/call-stream.js:274:14)
    at ClientHttp2Stream.emit (events.js:198:13)
    at ClientHttp2Stream.EventEmitter.emit (domain.js:466:23)
Error: Process exited with code 16
    at process.on.code (/home/user/project/node_modules/@google-cloud/functions-framework/build/src/invoker.js:271:38)
    at process.emit (events.js:198:13)
    at process.EventEmitter.emit (domain.js:448:20)
    at process.exit (internal/process/per_thread.js:168:15)
    at Object.logAndSendError (/home/user/project/node_modules/@google-cloud/functions-framework/build/src/logger.js:37:9)
    at process.on.err (/home/user/project/node_modules/@google-cloud/functions-framework/build/src/invoker.js:268:22)
    at process.emit (events.js:198:13)
    at process.EventEmitter.emit (domain.js:448:20)
    at emitPromiseRejectionWarnings (internal/process/promises.js:140:18)
    at process._tickCallback (internal/process/next_tick.js:69:34)
error Command failed with exit code 16.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

It occurs at the end of the execution of the function.

Any clue of what it is?

Version: “@google-cloud/functions-framework”: “^1.6.0”

Thanks!

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:12 (2 by maintainers)

github_iconTop GitHub Comments

4reactions
denisdnccommented, Aug 2, 2020

I tried to isolate some parts of the code and it seems to be LogginWinston it’s causing the error, when i comment the “loggingWinston” on the creation of the logger, it works just fine. I dont know if there’s a relation with the function framework.

Thanks!

code:

/** libraries */
const winston = require('winston')
const { LoggingWinston } = require('@google-cloud/logging-winston')

const loggingWinston = new LoggingWinston()

// Create a Winston logger that streams to Stackdriver Logging
// Logs will be written to: "projects/YOUR_PROJECT_ID/logs/winston_log"
const logger = winston.createLogger({
  level: 'info',
  transports: [
    new winston.transports.Console({
      level: 'debug',
      format: winston.format.combine(
        winston.format.colorize(),
        winston.format.simple()
      )
    }),
    // Add Stackdriver Logging
    loggingWinston
  ]
})

exports.execute = async (_request, response) => {
  logger.info('START')
  response.status(200).end()
}
3reactions
denisdnccommented, Aug 5, 2020

Hi there! I think i found out the problem, it’s not really a problem, but sure it seems to in the @google-cloud/logging-winston.

It was missing a permission for the Logging API on the service account. I think just the message it wasn’t much clear.

But the code is right here:

https://github.com/denisdnc/cloud-functions-example

Set a service account credentials path:

export GOOGLE_APPLICATION_CREDENTIALS="/home/user/credential.json"

And start the app:

npx @google-cloud/functions-framework --target=execute

Do the request on http://localhost:8080/

Then should log the problem above.

Thank you guys for the support!

Read more comments on GitHub >

github_iconTop Results From Across the Web

PERMISSION_DENIED: The caller does not have permission
The error I was getting was: PERMISSION_DENIED: Caller does not have required permission to use project project:random-id-11111.
Read more >
(Status(StatusCode="PermissionDenied", Detail="The caller ...
(Status(StatusCode="PermissionDenied", Detail="The caller does not have permission")) error when running C# examples. 70 views.
Read more >
The caller does not have permission to execute the specified ...
Hi I'am trying to create a document in a sub collection named "locations_favorites" who reference a collection named "locations" but the following ...
Read more >
Permission denied when deploying queue.yaml [137078982]
ERROR: (gcloud.app.deploy) PERMISSION_DENIED: The caller does not have permission ... The service account has the following permissions: App Engine Admin
Read more >
Troubleshooting - Profiler - Google Cloud
failed to create a profile, will retry: rpc error: code = PermissionDenied desc = The caller does not have permission. To resolve this...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found