user1157751
user1157751

Reputation: 2457

Google App Engine - App was unable to send logs

My app started to create some strange errors with logging since the last deployment:

  File "/env/lib/python3.6/site-packages/google/cloud/logging/handlers/transports/background_thread.py", line 118, in _safely_commit_batch
    batch.commit()
  File "/env/lib/python3.6/site-packages/google/cloud/logging/logger.py", line 612, in commit
    client.logging_api.write_entries(entries, **kwargs)
  File "/env/lib/python3.6/site-packages/google/cloud/logging/_gapic.py", line 124, in write_entries
    partial_success=partial_success)
  File "/env/lib/python3.6/site-packages/google/cloud/logging_v2/gapic/logging_service_v2_client.py", line 341, in write_log_entries
    request, retry=retry, timeout=timeout, metadata=metadata)
  File "/env/lib/python3.6/site-packages/google/api_core/gapic_v1/method.py", line 139, in __call__
    return wrapped_func(*args, **kwargs)
  File "/env/lib/python3.6/site-packages/google/api_core/retry.py", line 260, in retry_wrapped_func
    on_error=on_error,
  File "/env/lib/python3.6/site-packages/google/api_core/retry.py", line 177, in retry_target
    return target()
  File "/env/lib/python3.6/site-packages/google/api_core/timeout.py", line 206, in func_with_timeout
    return func(*args, **kwargs)
  File "/env/lib/python3.6/site-packages/google/api_core/grpc_helpers.py", line 61, in error_remapped_callable
    six.raise_from(exceptions.from_grpc_error(exc), exc)
  File "<string>", line 3, in raise_from
google.api_core.exceptions.PermissionDenied: 403 The caller does not have permission
"  
 timestamp:  "2018-09-19T21:35:58Z"  

However, if I run a local server, everything works normally.

I tried to install the newest log library locally, and tested that logs can be sent out in a local environment. Is there a way to debug this?

Upvotes: 2

Views: 272

Answers (1)

LundinCast
LundinCast

Reputation: 9810

You may want to check if the service account used by your deployed App Engine app holds the necessary permissions for logging. It's usually a service account like [email protected], unless you have changed it.

You may add the logging > Logs writer role to that service account in the Developer Console > IAM & Admin section.

Upvotes: 2

Related Questions