应用程式停止运作google.appengine.ext.db遗失或权限不足 [英] App stopped working google.appengine.ext.db Missing or insufficient permissions

查看:95
本文介绍了应用程式停止运作google.appengine.ext.db遗失或权限不足的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将python27应用程序部署到了Google App Engine.我上次部署是5年前,所以已经有一段时间了.该应用程序曾经可以完美运行,因此没有理由让我进行任何更改.但是今天,当我尝试调用

I have a python27 app deployed to google app engine. Last deployment I did was 5 years ago so its been a while. The app used to work perfectly and so there was no reason for me to change anything. But today I noticed this error in the logs when I try to call the fetch (or any other) API of google.appengine.ext.db:

from google.appengine.ext import db
db.Query(MyClass).fetch is giving error

Missing or insufficient permissions.
Traceback (most recent call last):
File "/base/alloc/tmpfs/dynamic_runtimes/python27g/174489198b39d9fb/python27/python27_lib/versions/third_party/webapp2-2.3/webapp2.py", line 545, in dispatch
return method(*args, **kwargs)
File "/base/data/home/apps/s~buy-sell-books/15.387717900252501903/handlers/buy.py", line 134, in get
self.handle_search_by_zipcode_request()
File "/base/data/home/apps/s~buy-sell-books/15.387717900252501903/handlers/buy.py", line 100, in handle_search_by_zipcode_request
results = q.fetch(25)
File "/base/alloc/tmpfs/dynamic_runtimes/python27g/174489198b39d9fb/python27/python27_lib/versions/1/google/appengine/ext/db/__init__.py", line 2161, in fetch
return list(self.run(limit=limit, offset=offset, **kwargs))
File "/base/alloc/tmpfs/dynamic_runtimes/python27g/174489198b39d9fb/python27/python27_lib/versions/1/google/appengine/ext/db/__init__.py", line 2330, in next
return self.__model_class.from_entity(self.__iterator.next())
File "/base/alloc/tmpfs/dynamic_runtimes/python27g/174489198b39d9fb/python27/python27_lib/versions/1/google/appengine/datastore/datastore_query.py", line 3345, in next
next_batch = self.__batcher.next_batch(Batcher.AT_LEAST_OFFSET)
File "/base/alloc/tmpfs/dynamic_runtimes/python27g/174489198b39d9fb/python27/python27_lib/versions/1/google/appengine/datastore/datastore_query.py", line 3231, in next_batch
batch = self.__next_batch.get_result()
File "/base/alloc/tmpfs/dynamic_runtimes/python27g/174489198b39d9fb/python27/python27_lib/versions/1/google/appengine/api/apiproxy_stub_map.py", line 615, in get_result
return self.__get_result_hook(self)
File "/base/alloc/tmpfs/dynamic_runtimes/python27g/174489198b39d9fb/python27/python27_lib/versions/1/google/appengine/datastore/datastore_query.py", line 2930, in __query_result_hook
self._batch_shared.conn.check_rpc_success(rpc)
File "/base/alloc/tmpfs/dynamic_runtimes/python27g/174489198b39d9fb/python27/python27_lib/versions/1/google/appengine/datastore/datastore_rpc.py", line 1379, in check_rpc_success
raise _ToDatastoreError(err)
Error: Missing or insufficient permissions.
request_id: "5f00ffc92c00ff0db6e314a6016b0001737e6275792d73656c6c2d626f6f6b7300013135000100"
timestamp: "2020-07-04T18:23:40.969Z"
location: "/base/data/home/apps/s~buy-sell-books/15.387717900252501903/handlers/buy.py:13"

我可以在控制台中看到以下默认服务帐户

I can see following default service account in my console

我想知道是否有人知道如何解决此问题?

I am wondering if anyone knows how to fix this?

推荐答案

我遇到的大多数解决方案都提到了默认服务帐户.我还遇到了据说可以运行gcloud auth application-default login的解决方案.在我的情况下,这些解决方案均无效.我的默认服务帐户已经设置.它甚至分配了 Editor 角色. 文档说

Most of the solutions I came across mentioned the default service account. I also came across solutions that said to run gcloud auth application-default login. None of these solutions worked in my case. My default service account was already setup. It even had Editor role assigned to it. This doc says

创建App Engine应用程序后,默认情况下是App Engine 服务帐户已创建,并用作App Engine的身份 服务. App Engine默认服务帐户与 您的Cloud专案并代表执行中的应用程式执行工作 在App Engine中.默认情况下,App Engine默认服务帐户具有 项目中的编辑者角色.这意味着任何具有以下权限的用户帐户 足够的权限将更改部署到Cloud项目也可以 运行对项目中所有资源具有读/写访问权限的代码.

After you create an App Engine application, the App Engine default service account is created and used as the identity of the App Engine service. The App Engine default service account is associated with your Cloud project and executes tasks on behalf of your apps running in App Engine. By default, the App Engine default service account has the Editor role in the project. This means that any user account with sufficient permissions to deploy changes to the Cloud project can also run code with read/write access to all resources within that project.

文档说

此服务帐户是由Google在创建应用程序时创建的 引擎应用程序,并被授予管理和使用所有云的完全权限 GCP项目中的服务.

This service account is created by Google when you create an App Engine app and is given full permissions to manage and use all Cloud services in a GCP project.

那有什么用呢?原来,我必须输入信用卡详细信息并启用计费.

so what gives? Turns out I had to enter credit card details and enable billing.

一旦我执行了该应用程序,便会再次恢复工作!

Once I did that app started working back again!

这篇关于应用程式停止运作google.appengine.ext.db遗失或权限不足的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆