ERROR: (gcloud.app.deploy) INVALID_ARGUMENT: unable to resolve source - google-app-engine

I am trying to deploy a go 1.11 runtime that used to work, but recently I've been getting: ERROR: (gcloud.app.deploy) INVALID_ARGUMENT: unable to resolve source errors.
Nothing in my app.yaml has changed, and the error message isn't helpful to understand what the issue could be. I ran it with the --verbosity=debug flag and get:
Building and pushing image for service [apiv1]
DEBUG: Could not call git with args ('config', '--get-regexp', 'remote\\.(.*)\\.url'): Command '['git', 'config', '--get-regexp', 'remote\\.(.*)\\.url']' returned non-zero exit status 1
INFO: Could not generate [source-context.json]: Could not list remote URLs from source directory: /var/folders/18/k3w6w7f169xg4mypdwj7p4_c0000gn/T/tmp6IkZKx/tmphibUAo
Stackdriver Debugger may not be configured or enabled on this application. See https://cloud.google.com/debugger/ for more information.
INFO: Uploading [/var/folders/18/k3w6w7f169xg4mypdwj7p4_c0000gn/T/tmpVHKXol/src.tgz] to [staging.wildfire-app-backend.appspot.com/asia.gcr.io/wildfire-app-backend/appengine/apiv1.20190506t090359:latest]
DEBUG: Using runtime builder root [gs://runtime-builders/]
DEBUG: Loading runtimes manifest from [gs://runtime-builders/runtimes.yaml]
INFO: Reading [<googlecloudsdk.api_lib.storage.storage_util.ObjectReference object at 0x105ca9b10>]
DEBUG: Resolved runtime [go1.11] as build configuration [gs://runtime-builders/go-1.11-builder-20181217154124.yaml]
INFO: Using runtime builder [gs://runtime-builders/go-1.11-builder-20181217154124.yaml]
INFO: Reading [<googlecloudsdk.api_lib.storage.storage_util.ObjectReference object at 0x105b03b50>]
DEBUG: (gcloud.app.deploy) INVALID_ARGUMENT: unable to resolve source
Traceback (most recent call last):
File "/usr/local/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/lib/googlecloudsdk/calliope/cli.py", line 985, in Execute
resources = calliope_command.Run(cli=self, args=args)
File "/usr/local/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/lib/googlecloudsdk/calliope/backend.py", line 795, in Run
resources = command_instance.Run(args)
File "/usr/local/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/lib/surface/app/deploy.py", line 90, in Run
parallel_build=False)
File "/usr/local/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/lib/googlecloudsdk/command_lib/app/deploy_util.py", line 636, in RunDeploy
flex_image_build_option=flex_image_build_option)
File "/usr/local/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/lib/googlecloudsdk/command_lib/app/deploy_util.py", line 411, in Deploy
image, code_bucket_ref, gcr_domain, flex_image_build_option)
File "/usr/local/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/lib/googlecloudsdk/command_lib/app/deploy_util.py", line 287, in _PossiblyBuildAndPush
self.deploy_options.parallel_build)
File "/usr/local/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/lib/googlecloudsdk/api_lib/app/deploy_command_util.py", line 450, in BuildAndPushDockerImage
return _SubmitBuild(build, image, project, parallel_build)
File "/usr/local/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/lib/googlecloudsdk/api_lib/app/deploy_command_util.py", line 483, in _SubmitBuild
build, project=project)
File "/usr/local/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/lib/googlecloudsdk/api_lib/cloudbuild/build.py", line 149, in ExecuteCloudBuild
build_op = self.ExecuteCloudBuildAsync(build, project)
File "/usr/local/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/lib/googlecloudsdk/api_lib/cloudbuild/build.py", line 133, in ExecuteCloudBuildAsync
build=build,))
File "/usr/local/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/lib/googlecloudsdk/third_party/apis/cloudbuild/v1/cloudbuild_v1_client.py", line 205, in Create
config, request, global_params=global_params)
File "/usr/local/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/lib/third_party/apitools/base/py/base_api.py", line 731, in _RunMethod
return self.ProcessHttpResponse(method_config, http_response, request)
File "/usr/local/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/lib/third_party/apitools/base/py/base_api.py", line 737, in ProcessHttpResponse
self.__ProcessHttpResponse(method_config, http_response, request))
File "/usr/local/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/lib/third_party/apitools/base/py/base_api.py", line 604, in __ProcessHttpResponse
http_response, method_config=method_config, request=request)
HttpBadRequestError: HttpError accessing <https://cloudbuild.googleapis.com/v1/projects/wildfire-app-backend/builds?alt=json>: response: <{'status': '400', 'content-length': '114', 'x-xss-protection': '0'
, 'x-content-type-options': 'nosniff', 'transfer-encoding': 'chunked', 'vary': 'Origin, X-Origin, Referer', 'server': 'ESF', '-content-encoding': 'gzip', 'cache-control': 'private', 'date': 'Mon, 06 May 2
019 16:04:41 GMT', 'x-frame-options': 'SAMEORIGIN', 'alt-svc': 'quic=":443"; ma=2592000; v="46,44,43,39"', 'content-type': 'application/json; charset=UTF-8'}>, content <{
"error": {
"code": 400,
"message": "unable to resolve source",
"status": "INVALID_ARGUMENT"
}
}
>
ERROR: (gcloud.app.deploy) INVALID_ARGUMENT: unable to resolve
Any advice would be useful, I also tried it with gcloud beta, I rotated my credentials and was of no use. My user has Owner role, but I added individually all the roles that might be necessary
App Engine Admin
App Engine Code Viewer
App Engine Deployer
App Engine Service Admin
Project Billing Manager
Cloud Build Service Account
Cloud Build Editor
Cloud Build Viewer
Owner
Storage Admin

Try disabling and enabling the Cloud Build API in your project so a new service account is created, then try to deploy again.
This ensures that Cloud Build has permission to start builds (the service account name should look like project-number#cloudbuild.gserviceaccount.com).

I found that it took a while for the API permissions to propagate fully.
I had this error after enabling the App Engine Admin API, but I waited a few minutes and tried again and it worked fine.

Cloud Build uses a service account instead of your user credential, so adding roles to your user won't help in this case.
You should be able to manually add the service account, [project-number]#cloudbuild.gserviceaccount.com, back to your account without re-enabling the API. Some users are known to delete random service accounts they don't recognize, which can sometimes cause this issue.
In summary, check if the service account exists. If so, give it all the roles it needs; if not, then create it and give it all the role it needs.

Related

Google App Engine Flexible deploy throwing ERROR: (gcloud.app.deploy) HttpError accessing

Hi I am getting this error when deploying nodejs application to flexible engine. I am unable to figure out where the issue is happening.
The error message I am getting
ERROR: (gcloud.app.deploy) HttpError accessing <https://appengine.googleapis.com/v1/apps/project-id/services/testws/versions?alt=json>: response: <{'vary': 'Origin, X-Origin, Referer', 'content-type': 'application/json; charset=UTF-8', 'date': 'Fri, 26 Mar 2021 20:37:27 GMT', 'server': 'ESF', 'cache-control': 'private', 'x-xss-protection': '0', 'x-frame-options': 'SAMEORIGIN', 'x-content-type-options': 'nosniff', 'alt-svc': 'h3-29=":443"; ma=2592000,h3-T051=":443"; ma=2592000,h3-Q050=":443"; ma=2592000,h3-Q046=":443"; ma=2592000,h3-Q043=":443"; ma=2592000,quic=":443"; ma=2592000; v="46,43"', 'transfer-encoding': 'chunked', 'status': '500', 'content-length': '109', '-content-encoding': 'gzip'}>, content <{
"error": {
"code": 500,
"message": "Internal error encountered.",
"status": "INTERNAL"
}
}
>
This may be due to network connectivity issues. Please check your network settings, and the status of the service you are trying to reach.
app.yaml
runtime: nodejs
env: flex
service: testws
manual_scaling:
instances: 1
network:
session_affinity: true
resources:
cpu: 1
memory_gb: 1
disk_size_gb: 2
env_variables:
KEY: "dev"
PRIVATE_KEY_URL: "key"
skip_files:
- ^node_modules/.*$
Gcloud SDK version
Google Cloud SDK 333.0.0
bq 2.0.65
core 2021.03.19
gsutil 4.60
kubectl 1.17.17
I have added the debug logs by running gcloud app deploy --verbosity="debug"
debug logs
>
This may be due to network connectivity issues. Please check your network settings, and the status of the service you are trying to reach.
Traceback (most recent call last):
File "/Users/shashi/google-cloud-sdk/lib/googlecloudsdk/calliope/cli.py", line 982, in Execute
resources = calliope_command.Run(cli=self, args=args)
File "/Users/shashi/google-cloud-sdk/lib/googlecloudsdk/calliope/backend.py", line 809, in Run
resources = command_instance.Run(args)
File "/Users/shashi/google-cloud-sdk/lib/surface/app/deploy.py", line 130, in Run
use_legacy_apis=args.use_legacy_apis)
File "/Users/shashi/google-cloud-sdk/lib/googlecloudsdk/command_lib/app/deploy_util.py", line 678, in RunDeploy
ignore_file=args.ignore_file)
File "/Users/shashi/google-cloud-sdk/lib/googlecloudsdk/command_lib/app/deploy_util.py", line 455, in Deploy
extra_config_settings)
File "/Users/shashi/google-cloud-sdk/lib/googlecloudsdk/api_lib/app/appengine_api_client.py", line 172, in DeployService
extra_config_settings)
File "/Users/shashi/google-cloud-sdk/lib/googlecloudsdk/api_lib/app/appengine_api_client.py", line 249, in _CreateVersion
return self.client.apps_services_versions.Create(create_request)
File "/Users/shashi/google-cloud-sdk/lib/googlecloudsdk/third_party/apis/appengine/v1/appengine_v1_client.py", line 830, in Create
config, request, global_params=global_params)
File "/Users/shashi/google-cloud-sdk/lib/third_party/apitools/base/py/base_api.py", line 729, in _RunMethod
http, http_request, **opts)
File "/Users/shashi/google-cloud-sdk/lib/third_party/apitools/base/py/http_wrapper.py", line 350, in MakeRequest
check_response_func=check_response_func)
File "/Users/shashi/google-cloud-sdk/lib/third_party/apitools/base/py/http_wrapper.py", line 406, in _MakeRequestNoRetry
check_response_func(response)
File "/Users/shashi/google-cloud-sdk/lib/googlecloudsdk/api_lib/util/apis.py", line 267, in _CheckResponseForApiEnablement
http_wrapper.CheckResponse(response)
File "/Users/shashi/google-cloud-sdk/lib/third_party/apitools/base/py/http_wrapper.py", line 223, in CheckResponse
raise exceptions.BadStatusCodeError.FromResponse(response)
apitools.base.py.exceptions.BadStatusCodeError: HttpError accessing <https://appengine.googleapis.com/v1/apps/project-id/services/awsockets/versions?alt=json>: response: <{'vary': 'Origin, X-Origin, Referer', 'content-type': 'application/json; charset=UTF-8', 'date': 'Sun, 28 Mar 2021 22:29:25 GMT', 'server': 'ESF', 'cache-control': 'private', 'x-xss-protection': '0', 'x-frame-options': 'SAMEORIGIN', 'x-content-type-options': 'nosniff', 'alt-svc': 'h3-29=":443"; ma=2592000,h3-T051=":443"; ma=2592000,h3-Q050=":443"; ma=2592000,h3-Q046=":443"; ma=2592000,h3-Q043=":443"; ma=2592000,quic=":443"; ma=2592000; v="46,43"', 'transfer-encoding': 'chunked', 'status': '500', 'content-length': '109', '-content-encoding': 'gzip'}>, content <{
"error": {
"code": 500,
"message": "Internal error encountered.",
"status": "INTERNAL"
}
}
>
I found the reason for the error and the solution to fix it if anyone is facing this issue.
Reason - The App engine Flexible Service Account was accidentally deleted from the google cloud project. As mentioned in this link - service-account
The App Engine flexible environment service agent has the App Engine Flexible Environment Service Agent role. The role includes a set of permissions needed by Node.js flexible environment to manage your flexible environment apps. For example, this role includes permissions to perform the following tasks:
1. Deploying a new version.
2. Stopping or deleting existing versions.
3. Automatic weekly restarts and system updates.
Solution - Add a service account by going to IAM and adding an account of name mentioned below with role App Engine Flexible Environment Service Agent. As mentioned in this link - restore-service-account
service-[YOUR_PROJECT_NUMBER]#gae-api-prod.google.com.iam.gserviceaccount.com
I have raised an issue with google tracker to change the error message. You can track the issue here - issue-tracker
Update - adding the below image for further clarity. if you try to add the deleted account, it will be suggested by the system.
I had a similar error message when deploying to the standard environment.
To resolve it, I added the verbosity=debug flag as in gcloud app deploy --verbosity="debug" as suggested.
Then I could see my earlier token replacement step was not working, leading to an invalid app.yaml
The verbose output shows the app.yaml like this.
2022-05-25T23:39:43.8269116Z DEBUG: Converted YAML to JSON: "{
2022-05-25T23:39:43.8269423Z "basicScaling": {
2022-05-25T23:39:43.8269664Z "idleTimeout": "900s",
2022-05-25T23:39:43.8269912Z "maxInstances": 4
2022-05-25T23:39:43.8270102Z },
2022-05-25T23:39:43.8270288Z "entrypoint": {
2022-05-25T23:39:43.8270550Z "shell": "npm run start:prod"
2022-05-25T23:39:43.8270764Z },
2022-05-25T23:39:43.8271862Z "instanceClass": "B4",
2022-05-25T23:39:43.8272089Z "runtime": "nodejs16",
2022-05-25T23:39:43.8272316Z "vpcAccessConnector": {
2022-05-25T23:39:43.8272882Z "name": "projects/#{project_id}#/locations/#{region}#/connectors/sql-access-conn-#{environment}#"
2022-05-25T23:39:43.8273192Z }
2022-05-25T23:39:43.8273380Z }"
Putting in a valid project_id for the vpcAccessConnector fixed the error.

Google Cloud appengine deployment: No app found

I have inherited a php codebase that uses google appengine, so I have a fully built app locally that I am trying to deploy. But when I run:
gcloud app deploy --project project-name --verbosity=debug
I get the error below. I don't understand the staging command error because in the app.yaml I specify runtime: php55. I don't know what the API endpoint error means, and I also don't understand why no app was found. Any help on any of these errors would be much appreciated.
DEBUG: Running [gcloud.app.deploy] with arguments: [--project:
"project-name", --verbosity: "debug"] DEBUG: No staging command found
for runtime [php55] and environment [STANDARD]. DEBUG: API endpoint:
[https://appengine.googleapis.com/], API version: [v1] DEBUG: No app
found: Traceback (most recent call last): File
"/Users/myname/Downloads/google-cloud-sdk/lib/googlecloudsdk/command_lib/app/deploy_util.py",
line 679, in _PossiblyCreateApp
return api_client.GetApplication() File "/Users/myname/Downloads/google-cloud-sdk/lib/googlecloudsdk/api_lib/app/appengine_api_client.py",
line 66, in GetApplication
return self.client.apps.Get(request) File "/Users/myname/Downloads/google-cloud-sdk/lib/googlecloudsdk/third_party/apis/appengine/v1/appengine_v1_client.py",
line 1124, in Get
config, request, global_params=global_params) File "/Users/myname/Downloads/google-cloud-sdk/lib/third_party/apitools/base/py/base_api.py",
line 722, in _RunMethod
return self.ProcessHttpResponse(method_config, http_response, request) File
"/Users/myname/Downloads/google-cloud-sdk/lib/third_party/apitools/base/py/base_api.py",
line 728, in ProcessHttpResponse
self.__ProcessHttpResponse(method_config, http_response, request)) File
"/Users/myname/Downloads/google-cloud-sdk/lib/third_party/apitools/base/py/base_api.py",
line 599, in __ProcessHttpResponse
http_response, method_config=method_config, request=request) HttpNotFoundError: HttpError accessing
https://appengine.googleapis.com/v1/apps/project-name?alt=json:
response: <{'status': '404', 'content-length': '136',
'x-xss-protection': '0', 'x-content-type-options': 'nosniff',
'transfer-encoding': 'chunked', 'vary': 'Origin, X-Origin, Referer',
'server': 'ESF', '-content-encoding': 'gzip', 'cache-control':
'private', 'date': 'Tue, 24 Sep 2019 22:49:44 GMT', 'x-frame-options':
'SAMEORIGIN', 'alt-svc': 'quic=":443"; ma=2592000; v="46,43"',
'content-type': 'application/json; charset=UTF-8'}>, content <{
"error": {
"code": 404,
"message": "Could not find Application \"project-name\".",
"status": "NOT_FOUND" } }
The value for --project must correspond to a Google Cloud Platform project ID.
It's unclear whether you replaced your actual project ID (NB Project IDs and Project names are distinct properties, see link) with project-name when you pasted your question.
One way to verify that the project exists would be to:
gcloud projects describe [[PROJECT]]
Assuming the project exists, a second consideration is that (since you're not specifying deployables), the command assumes the working directory contains an app.yaml (App Engine app configuration) file.

Permission denied during gcloud app deploy using Google Cloud SDK

It is insanely hard, to deploy an app to Google App Engine, using Google Cloud SDK.
I had tried the below 2 commands
C:\Users\yccheok\Desktop\jstock-android-appengine>gcloud config set project jstock-android
Updated property [core/project].
C:\Users\yccheok\Desktop\jstock-android-appengine>gcloud app deploy app.yaml --log-http --verbosity=debug
DEBUG: Running [gcloud.app.deploy] with arguments: [--log-http: "true", --verbosity: "debug", DEPLOYABLES:1: "['app.yaml']"]
DEBUG: No staging command found for runtime [python27] and environment [STANDARD].
DEBUG: API endpoint: [https://appengine.googleapis.com/], API version: [v1]
=======================
==== request start ====
uri: https://appengine.googleapis.com/v1/apps/jstock-android?alt=json
method: GET
== headers start ==
Authorization: Bearer ya29.GlxEBb1XVP1JK93-ARiaN_ZgiMbvZmw5KWfvJVfibDJ4FK_ZaMRoU1jVDTiWzsY606GSduJKJd9Nm8zA-_Iql5mGn4AMk4QVl8mPRycfekeZnOOHtbUvpkBMgOLOQA
accept: application/json
accept-encoding: gzip, deflate
content-length: 0
user-agent: google-cloud-sdk x_Tw5K8nnjoRAqULM9PFAC2b gcloud/184.0.0 command/gcloud.app.deploy invocation-id/c9ae232d33b346d787b95a36e28c38c0 environment/None environment-version/None interactive/True python/2.7.13 (Windows NT 10.0.16299)
== headers end ==
== body start ==
== body end ==
==== request end ====
---- response start ----
-- headers start --
-content-encoding: gzip
alt-svc: hq=":443"; ma=2592000; quic=51303431; quic=51303339; quic=51303338; quic=51303337; quic=51303335,quic=":443"; ma=2592000; v="41,39,38,37,35"
cache-control: private
content-length: 335
content-type: application/json; charset=UTF-8
date: Tue, 16 Jan 2018 19:16:21 GMT
server: ESF
status: 403
transfer-encoding: chunked
vary: Origin, X-Origin, Referer
x-content-type-options: nosniff
x-frame-options: SAMEORIGIN
x-xss-protection: 1; mode=block
-- headers end --
-- body start --
{
"error": {
"code": 403,
"message": "Operation not allowed",
"status": "PERMISSION_DENIED",
"details": [
{
"#type": "type.googleapis.com/google.rpc.ResourceInfo",
"resourceType": "gae.api",
"description": "The \"appengine.applications.get\" permission is required."
}
]
}
}
-- body end --
total round trip time (request+response): 1.796 secs
---- response end ----
----------------------
DEBUG: (gcloud.app.deploy) Permissions error fetching application [apps/jstock-android]. Please make sure you are using the correct project ID and that you have permission to view applications on the project.
Traceback (most recent call last):
File "C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\lib\googlecloudsdk\calliope\cli.py", line 797, in Execute
resources = calliope_command.Run(cli=self, args=args)
File "C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\lib\googlecloudsdk\calliope\backend.py", line 757, in Run
resources = command_instance.Run(args)
File "C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\lib\surface\app\deploy.py", line 65, in Run
parallel_build=False)
File "C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\lib\googlecloudsdk\command_lib\app\deploy_util.py", line 543, in RunDeploy
app = _PossiblyCreateApp(api_client, project)
File "C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\lib\googlecloudsdk\command_lib\app\deploy_util.py", line 703, in _PossiblyCreateApp
api_client._FormatApp()))) # pylint: disable=protected-access
HttpException: Permissions error fetching application [apps/jstock-android]. Please make sure you are using the correct project ID and that you have permission to view applications on the project.
ERROR: (gcloud.app.deploy) Permissions error fetching application [apps/jstock-android]. Please make sure you are using the correct project ID and that you have permission to view applications on the project.
C:\Users\yccheok\Desktop\jstock-android-appengine>
Then, I went through https://cloud.google.com/appengine/docs/admin-api/accessing-the-api , it mentioned I need to use Admin API. So, I do it step by step carefully.
Step 1
Step 2
It mentions Admin API is enabled. Now I need credential.
Step 3
Step 4
OK. Now they mention I don't need create new credential. I can use Application Default Credentials ?!
Step 5
So, I went to https://developers.google.com/identity/protocols/application-default-credentials?hl=en_GB . I learn that I need to run
C:\Users\yccheok\Desktop\jstock-android-appengine>gcloud auth application-default login
Your browser has been opened to visit:
https://accounts.google.com/o/oauth2/auth?redirect_uri=http%3A%2F%2Flocalhost%3A8085%2F&prompt=select_account&response_type=code&client_id=764086051850-6qr4p6gpi6hn506pt8ejuq83di341hur.apps.googleusercontent.com&scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fuserinfo.email+https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fcloud-platform&access_type=offline
Credentials saved to file: [C:\Users\yccheok\AppData\Roaming\gcloud\application_default_credentials.json]
These credentials will be used by any library that requests
Application Default Credentials.
Step 6
Step 7
Still, after completing the above 7 steps, I still get the exact same error message, when trying to run
gcloud app deploy app.yaml --log-http --verbosity=debug
Can anyone let me know, what step I'm still require, in order to deploy my Python app to Google App Engine, using Google Cloud SDK?
The Admin API is for programmatically deploying the app, not for deploying using gcloud app deploy, for which you don't even need the Admin API enabled for your app.
From Deploying a Python App:
To programmatically deploy your apps, use the Admin API.
Before you begin
Before you can deploy your app:
The Owner of the GCP project must create the App Engine application.
Ensure that your user account includes the required privileges.
(but I can see how the above could be mis-intrepreted as an invitation to use the Admin API)
Most likely the account actually used by gcloud app deploy is missing or doesn't have the required permissions.
You can check the acount used with gcloud auth list. In my case the account is my email address, not a service account (I'm not sure if a service account can be used).
Use gcloud auth login (and maybe gcloud auth revoke) if you need a different account.
And you can check the account's privileges (if any) on the project/app on the IAM Page.
One additional note on this,
When you enable the App Engine API and the cloud builder api, make sure the Cloud Build Service Account also has access to the project.
I ran into that problem after enabling the correct apis.
This was using a build trigger. I could deploy locally from a command line because I was authenticated as myself. However, if you are using a build trigger, it will use the build service account, which needs access.
Hope this helps.
I had this issue. In my case it was solved by setting the project using the project ID, rather than the project name. See this answer
gcloud app deploy ERROR: Permissions error fetching application [apps/<PROJECT_NAME>]

gcloud app deploy give 400 / forbidden error / cannot push img to google container registry

I am trying to deploy .net core application from google compute vm to google app engine using gcloud app deploy. I get the following error
> WARNING: We couldn't validate that your project is ready to deploy to App Engine Flexible Environment. If deployment fails, please check the following mess
age and try again:
Server responded with code [400]:
Bad Request Unexpected HTTP status 400.
Failed Project Preparation (app_id='s~project-id'). Out of retries. Last error: Temporary error occurred while verifying project: TEMPORARY_ERROR: Unabl
e to check API status
Beginning deployment of service [default]...
WARNING: Deployment of App Engine Flexible Environment apps is currently in Beta
Building and pushing image for service [default]
Some files were skipped. Pass `--verbosity=info` to see which ones.
ERROR: (gcloud.app.deploy) Could not copy [/tmp/tmpLwvVOb/src.tgz] to [us.gcr.io/project-id/appengine/default.20170118t043919:latest]: HttpError accessing
<https://www.googleapis.com/resumable/upload/storage/v1/b/staging.project-id.appspot.com/o?uploadType=resumable&alt=json&name=us.gcr.io%2Fcasepro-v3%2Fappe
ngine%2Fdefault.20170118t043919%3Alatest>: response: <{'status': '403', 'content-length': '166', 'vary': 'Origin, X-Origin', 'server': 'UploadServer', 'x-g
uploader-uploadid': 'AEnB2UqprxH-2tIhsSZdGxDOtS8UnWSI29YTo4kaptNK67SWJpLVqR0zEtCAHgFyE64wj1HfCyUL5sy9z4AZkTRFYuxXfdw5TA', 'date': 'Wed, 18 Jan 2017 04:40:0
0 GMT', 'alt-svc': 'quic=":443"; ma=2592000; v="35,34"', 'content-type': 'application/json; charset=UTF-8'}>, content <{
"error": {
"errors": [
{
"domain": "global",
"reason": "forbidden",
"message": "Forbidden"
}
],
"code": 403,
"message": "Forbidden"
}
}
>. Please retry.
I have already enabled billing api, app engine admin api and storage api. Service a/c that is being used has editor rights. VM instance has been created using cloud launcher for Jenkins Bitnami package. I am trying to deploy app from command line from the vm before I configure Jenkins to do the same.
What to do to resolve this?
The problem is that gcloud app deploy is trying to deploy to the project id 'project-id', which cannot be your project id.
Try setting the project like this:
gcloud config set project MY-PROJECT-ID
Then, retry the gcloud app deploy command.
If this fails, please reply with your full gcloud command line, and the results of these two commands:
gcloud config list
gcloud version

Getting SSLCertificateError When Fetching OAuth Token to Access Google Cloud Services

I'm working with a local-dev environment of Python GAE. In my code, I'm using the app_identity module to fetch the App ID Token for my project, like this:
scope = "https://www.googleapis.com/auth/userinfo.email"
app_id_token, expiry = app_identity.get_access_token(scope)
But when that pathway is invoked, I get this error thrown from the appengine module. It appears that when my project attempts to fetch an OAuth token to access Google Cloud services it is getting an SSL validation error on the URL used to get that token.
ERROR 2017-01-03 02:41:11,489 api_server.py:272] Exception while handling service_name: "app_identity_service"
method: "GetAccessToken"
request: "\n.https://www.googleapis.com/auth/cloud-platform"
request_id: "MzGyxBKeMe"
Traceback (most recent call last):
File "/opt/google-cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/api_server.py", line 247, in _handle_POST
api_response = _execute_request(request).Encode()
File "/opt/google-cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/api_server.py", line 186, in _execute_request
make_request()
File "/opt/google-cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/api_server.py", line 181, in make_request
request_id)
File "/opt/google-cloud-sdk/platform/google_appengine/google/appengine/api/apiproxy_stub.py", line 131, in MakeSyncCall
method(request, response)
File "/opt/google-cloud-sdk/platform/google_appengine/google/appengine/api/app_identity/app_identity_keybased_stub.py", line 223, in _Dynamic_GetAccessToken
headers={'Content-Type': 'application/x-www-form-urlencoded'})
File "/opt/google-cloud-sdk/platform/google_appengine/google/appengine/api/urlfetch.py", line 271, in fetch
return rpc.get_result()
File "/opt/google-cloud-sdk/platform/google_appengine/google/appengine/api/apiproxy_stub_map.py", line 613, in get_result
return self.__get_result_hook(self)
File "/opt/google-cloud-sdk/platform/google_appengine/google/appengine/api/urlfetch.py", line 432, in _get_fetch_result
'Invalid and/or missing SSL certificate for URL: ' + url)
SSLCertificateError: Invalid and/or missing SSL certificate for URL: https://accounts.google.com/o/oauth2/token
What confuses me is that this doesn't seem like it should be an environment configuration problem because it is SSL cert validation. However, neither of my teammates see this problem when we work from the same commit in our repository. I've tried re-cloning my repository, rebooting my machine, resetting my Docker setup. None of it has had an effect. Any advice into what's going on would be appreciated. Thank you.
One of my teammates figured out the solution to this. One of the certs bundled with the SDK have an expired cert in their chain... so my setup broke with the New Year.
HTTPException: invalid and/or missing SSL certificate for url: https://accounts.google.com/o/oauth2/token
He removed my certs that were bundled with the SDK, which causes GAE to use the OS's defaults.

Resources