An internal error occurred while calling service consumer manager for service account.
Creating App Engine application in projectPROJECT and REGION....failed. DEBUG: (gcloud.app.create) Error Response: [13] an internal error has occurred
请求日志
Service account creation is not allowed on this project.
docker pull ${IMAGE_URL}
export CONTAINER_ID=$(docker create ${IMAGE_URL})
docker ps -a # the list should contain the newly created container with status `Created`
导出容器映像的根文件系统 (rootfs):
docker export ${CONTAINER_ID} -o gae_app.tar
mkdir gae_app
mv -v gae_app.tar gae_app/
cd gae_app/
tar -xf gae_app.tar
ls -la # inspect the container FS
或者,如果您不需要 TAR 文件,请运行以下命令:
mkdir gae_app
cd gae_app/
docker export ${CONTAINER_ID} | tar -xC <dest>
ls -la # inspect the container FS
kernel: [ 133.706951] Out of memory: Kill process 4490 (java) score 878 or sacrifice child
kernel: [ 133.714468] Killed process 4306 (java) total-vm:5332376kB, anon-rss:2712108kB, file-rss:0kB
[[["易于理解","easyToUnderstand","thumb-up"],["解决了我的问题","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["很难理解","hardToUnderstand","thumb-down"],["信息或示例代码不正确","incorrectInformationOrSampleCode","thumb-down"],["没有我需要的信息/示例","missingTheInformationSamplesINeed","thumb-down"],["翻译问题","translationIssue","thumb-down"],["其他","otherDown","thumb-down"]],["最后更新时间 (UTC):2025-09-04。"],[[["\u003cp\u003eApp creation failures with permission errors are often due to the \u003ccode\u003econstraints/iam.disableServiceAccountCreation\u003c/code\u003e policy, which prevents the creation of the App Engine default service account.\u003c/p\u003e\n"],["\u003cp\u003eIf the latest code changes are not reflected after deployment, you can use Cloud Logging to get the container image URL and export the root file system for inspection to verify the correct code is present.\u003c/p\u003e\n"],["\u003cp\u003eNginx connection errors, typically seen as 502 errors, occur in the flexible environment when the app container is unreachable, often caused by the application's connection keepalive timeout being shorter than Nginx's.\u003c/p\u003e\n"],["\u003cp\u003eOut of memory errors in the flexible environment, which manifest as 502 errors and log entries, indicate insufficient instance memory, requiring an update to the \u003ccode\u003ememory_gb\u003c/code\u003e setting in the \u003ccode\u003eapp.yaml\u003c/code\u003e file.\u003c/p\u003e\n"],["\u003cp\u003eA high number of waiting connections relative to active connections can cause 502 errors, requiring users to monitor Cloud Monitoring metrics to ensure the number of waiting connections is less than or equal to 75% of active connections.\u003c/p\u003e\n"]]],[],null,["# Troubleshoot serving issues in App Engine\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\nThis page describes common app initialization and serving errors in\nApp Engine and methods to troubleshoot them.\n\n### Permission error when creating an app with the default service account\n\nWhen you create an app after enabling the\nApp Engine API for the first time, it might fail with the following errors: \n\n### gcloud CLI\n\n An internal error occurred while calling service consumer manager for service account.\n Creating App Engine application in project\u003cvar translate=\"no\"\u003ePROJECT\u003c/var\u003e and \u003cvar translate=\"no\"\u003eREGION\u003c/var\u003e....failed. DEBUG: (gcloud.app.create) Error Response: [13] an internal error has occurred\n\n### Request logs\n\n Service account creation is not allowed on this project.\n\n### Console\n\n Error while initialising App Engine.\n\nThis error might occur due to the enforcement of the organization policy constraint [`constraints/iam.disableServiceAccountCreation`](/resource-manager/docs/organization-policy/restricting-service-accounts#disable_service_account_creation) when creating your\napp. This policy prevents the provisioning of the [App Engine default service account](/appengine/docs/standard/configure-service-accounts) `PROJECT_ID@appspot.gserviceaccount.com`.\n\nTo resolve this issue, you must temporarily remove the organization policy\nconstraint `constraints/iam.disableServiceAccountCreation` to allow for the\ncreation and deployment of the App Engine default service account. The default\nservice account is necessary for app creation and can't be skipped. This is also\napplicable when you use a per-version service account.\nThe App Engine default service account can be deleted or replaced\nwith a service account that you create after successful deployment.\n\nIf you are using a service account that you created, review the [Overview of role recommendations](/policy-intelligence/docs/role-recommendations-overview)\nto understand how to enforce restricting permissions, such as providing a\ntoken creator role on the service account you create for the service agent.\n\nApplication isn't serving the latest code changes\n-------------------------------------------------\n\nIf your application isn't serving the latest code changes after deployment, you\ncan use the root file system of the container to check the contents. The following\ntroubleshooting steps show how to fetch the container image, and export the root file\nsystem for further analysis:\n\n1. Use [Cloud Logging](/appengine/docs/flexible/writing-application-logs?tab=go#logs_explorer) to obtain the container image URL, with the filter\n `GAE_FULL_APP_CONTAINER`. After you apply the filter, Cloud Logging\n displays the container image URL, with your fully qualified domain name\n (FQDN). For example,\n `GAE_FULL_APP_CONTAINER: `\u003cvar translate=\"no\"\u003eFQDN\u003c/var\u003e`/`\u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e`/appengine/`\u003cvar translate=\"no\"\u003eSERVICE_NAME\u003c/var\u003e`.`\u003cvar translate=\"no\"\u003eVERSION_ID\u003c/var\u003e`@sha256:`\u003cvar translate=\"no\"\u003eSHA256_DIGEST\u003c/var\u003e.\n\n2. Run the following command to export the container image URL:\n\n export IMAGE_URL='\u003cvar translate=\"no\"\u003eFQDN\u003c/var\u003e/\u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e/appengine/\u003cvar translate=\"no\"\u003eSERVICE_NAME\u003c/var\u003e.\u003cvar translate=\"no\"\u003eVERSION_ID\u003c/var\u003e@sha256:\u003cvar translate=\"no\"\u003eSHA256_DIGEST\u003c/var\u003e'\n\n Replace:\n - \u003cvar translate=\"no\"\u003eFQDN\u003c/var\u003e with the fully qualified domain name of the container image URL.\n - \u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e with the project ID of your Google Cloud project.\n - \u003cvar translate=\"no\"\u003eSERVICE_NAME\u003c/var\u003e with your service name.\n - \u003cvar translate=\"no\"\u003eVERSION_ID\u003c/var\u003e with the version ID of the service.\n - \u003cvar translate=\"no\"\u003eSHA256_DIGEST\u003c/var\u003e with the [SHA256](/iap/docs/reference/app-engine-apis#iap_properties) value.\n3. Create a new container with the container image URL:\n\n docker pull ${IMAGE_URL}\n export CONTAINER_ID=$(docker create ${IMAGE_URL})\n docker ps -a # the list should contain the newly created container with status `Created`\n\n4. Export the root file system (`rootfs`) of the container image:\n\n docker export ${CONTAINER_ID} -o gae_app.tar\n mkdir gae_app\n mv -v gae_app.tar gae_app/\n cd gae_app/\n tar -xf gae_app.tar\n ls -la # inspect the container FS\n\n Alternatively, if you don't require the `TAR` file, run the following command: \n\n mkdir gae_app\n cd gae_app/\n docker export ${CONTAINER_ID} | tar -xC \u003cdest\u003e\n ls -la # inspect the container FS\n\n Analyze the contents of the root file system to verify if the latest code\n changes are present.\n5. Run the following command to clean up the image:\n\n docker container rm ${CONTAINER_ID}\n docker image rm ${IMAGE_URL}\n unset IMAGE_URL CONTAINER_ID\n\n### Nginx fails to connect or contact the app container\n\nThe following error only occurs in the App Engine flexible environment and typically returns with\n502 errors immediately after the error: \n\n recv() failed (104: Connection reset by peer) while reading response header from upstream\n\nThis error indicates that nginx reverse proxy (nginx sidecar) is unable to reach\nthe app container. In the logs, you can compare the close timing of the 502\nerror in the nginx log with the timing of the nginx.error log. A nginx.error\nfollowed immediately by a 502 nginx error is likely the cause of the nginx 502\nerror.\n\nThis error often occurs when the connection keepalive timeout of the\napplication is smaller than the keepalive timeout of nginx. As nginx in the App Engine flexible environment\nhas `keepalive_timeout` of 650 seconds, applications need to keep connections alive for\nat least this long. By default, Node.js applications have\n[`keepAliveTimeout`](https://nodejs.org/api/http.html#serverkeepalivetimeout) of\n5000 milliseconds. In this case, you can set `server.keepAliveTimeout` to 700000 milliseconds.\n\nTo troubleshoot, check the logs written by the code running in your app\ncontainer by [connecting to the VM instance](/appengine/docs/flexible/debugging-an-instance), and add more logging, if necessary, to find the root cause.\n\n### Insufficient memory\n\nThe following out of memory error occurs in the App Engine flexible environment, and typically\nreturns with 502 errors: \n\n kernel: [ 133.706951] Out of memory: Kill process 4490 (java) score 878 or sacrifice child\n kernel: [ 133.714468] Killed process 4306 (java) total-vm:5332376kB, anon-rss:2712108kB, file-rss:0kB\n\nThis error indicates that App Engine has terminated the application.\n\nThis error occurs when the instance has insufficient memory. By default App Engine flexible environment\nhas 1GB of memory, with only 600MB available for the application container.\n\nTo troubleshoot, check the logs for an out of memory entry, and update\nthe [`memory_gb`](/appengine/docs/flexible/go/reference/app-yaml#resource-settings)\nconfiguration in your `app.yaml` file, and redeploy.\n\n### Insufficient open connections to handle incoming requests\n\nApps might encounter a 502 error if the maximum number of waiting connections\nis equal to or greater than 75% of the number of active connections.\n\nTo resolve the issue, check the [Cloud Monitoring metrics](/monitoring/api/metrics_gcp_a_b#gcp-appengine)\nfor the maximum number of active and waiting connections, and decrease the number\nof waiting connections to ensure that the maximum number of waiting connections\nis less than or equal to 75% of the number of active connections."]]