2
votes

I am trying to deploy node.js application to google cloud platform, So I have taken up following approach:

Assume my project id : "logger"(#445533661888)

1) I followed this documentation link to deploy application, link : https://cloud.google.com/nodejs/resources/frameworks/express

2) Projects app.yaml includes :

runtime: nodejs
vm: true
service: default
skip_files:
  - ^(.*/)?.*/node_modules/.*$

3) Now went to google cloud console --> IAM & Admin menu, here I can see [email protected] entry, Also I have added permission of owner to [email protected] to this service account

4) Now used command gcloud auth login to authenticate and used [email protected] to complete authentication

4) Now I used gcloud preview app deploy to start deployment, in this request's response I get Bad Request error 400 and Message as

App engine service account has insufficient permissions for project. Developer or owner required

I am presenting stack trace :

C:\Users\Maulikwin8>gcloud config list
Your active configuration is: [default]

[app]
suppress_change_warning = true
[core]
account = [email protected]
disable_usage_reporting = False
project = logger

C:\Users\Maulikwin8>cd C:\Users\Maulikwin8\Documents\swan\rnd\node-express-js\nodejs-docs-samples-master\appengine\express

C:\Users\Maulikwin8\Documents\swan\rnd\node-express-js\nodejs-docs-samples-master\appengine\express>gcloud preview app deploy --verbosity=debug
DEBUG: Running gcloud.preview.app.deploy with Namespace(__calliope_internal_deepest_parser=ArgumentParser(prog='gcloud.preview.app.deploy', usage=None, description="*(BETA)* This command is used to deploy both code and configuration to the
App Engine\nserver.  As an input it takes one or more ``DEPLOYABLES'' that should be\nuploaded.  A ``DEPLOYABLE'' can be a service's .yaml file or a configuration's\n.yaml file.", version=None, formatter_class=<class 'argparse.HelpFormatter
'>, conflict_handler='error', add_help=False), account=None, authority_selector=None, authorization_token_file=None, bucket=None, cmd_func=<bound method Command.Run of <googlecloudsdk.calliope.backend.Command object at 0x03078550>>, command
_path=['gcloud', 'preview', 'app', 'deploy'], configuration=None, credential_file_override=None, deployables=[], docker_build=None, document=None, force=False, format=None, h=None, help=None, http_timeout=None, ignore_bad_certs=False, image
_url=None, log_http=None, project=None, promote=None, quiet=None, repo_info_file=None, server=None, stop_previous_version=None, trace_email=None, trace_log=None, trace_token=None, user_output_enabled=None, verbosity='debug', version=None).
INFO: Refreshing access_token
DEBUG: API endpoint: [https://appengine.googleapis.com/], API version: [v1beta4]
You are about to deploy the following services:
 - logger/deployment (from [C:\Users\Maulikwin8\Documents\swan\rnd\node-express-js\nodejs-docs-samples-master\appengine\express\app.yaml])
     Deployed URL: [https://deployment-dot-logger.appspot.com]

Do you want to continue (Y/n)?  Y

Beginning deployment...
DEBUG: No bucket specified, retrieving default bucket.
DEBUG: Using bucket [<googlecloudsdk.api_lib.app.cloud_storage.BucketReference object at 0x03E7A7B0>].
DEBUG: Host: appengine.google.com
DEBUG: _Authenticate configuring auth; needs_auth=False
DEBUG: Sending request to https://appengine.google.com/api/vms/prepare?app_id=logger headers={'X-appcfg-api-version': '1', 'content-length': '0', 'Content-Type': 'application/octet-stream'} body=
INFO: Attempting refresh to obtain initial access_token
INFO: Refreshing access_token
DEBUG: Got http error 400.
DEBUG: Unexpected results: {'status': '400', 'alternate-protocol': '443:quic', 'content-length': '162', 'expires': 'Mon, 01 Jan 1990 00:00:00 GMT', 'server': 'Google Frontend', 'cache-control': 'no-cache', 'date': 'Wed, 11 May 2016 10:44:32
 GMT', 'alt-svc': 'quic=":443"; ma=2592000; v="33,32,31,30,29,28,27,26,25"', 'content-type': 'text/plain'}
WARNING: If this is your first deployment, please try again.
DEBUG: (gcloud.preview.app.deploy) Server responded with code [400]:
  Bad Request Unexpected HTTP status 400.
  Failed Project Preparation (app_id='s~logger'). App Engine service account has insufficient permissions for project. Developer or owner required.
Traceback (most recent call last):
  File "C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\lib\googlecloudsdk\calliope\cli.py", line 647, in Execute
    result = args.cmd_func(cli=self, args=args)
  File "C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\lib\googlecloudsdk\calliope\backend.py", line 1407, in Run
    resources = command_instance.Run(args)
  File "C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\lib\surface\preview\app\deploy.py", line 482, in Run
    deploy_command_util.DoPrepareManagedVms(clients.gae)
  File "C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\lib\googlecloudsdk\api_lib\app\deploy_command_util.py", line 260, in DoPrepareManagedVms
    gae_client.PrepareVmRuntime()
  File "C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\lib\googlecloudsdk\api_lib\app\appengine_client.py", line 207, in PrepareVmRuntime
    rpcserver.Send('/api/vms/prepare', app_id=self.project)
  File "C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\lib\googlecloudsdk\api_lib\app\util.py", line 365, in Send
    response = self._server.Send(*args, **kwargs)
  File "C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\lib\googlecloudsdk\third_party\appengine\tools\appengine_rpc_httplib2.py", line 298, in Send
    'Unexpected HTTP status %s' % status)
  File "C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\lib\googlecloudsdk\third_party\appengine\tools\appengine_rpc_httplib2.py", line 82, in RaiseHttpError
    raise urllib2.HTTPError(url, response_info.status, msg, response_info, stream)
RPCError: Server responded with code [400]:
  Bad Request Unexpected HTTP status 400.
  Failed Project Preparation (app_id='s~logger'). App Engine service account has insufficient permissions for project. Developer or owner required.
ERROR: (gcloud.preview.app.deploy) Server responded with code [400]:
  Bad Request Unexpected HTTP status 400.
  Failed Project Preparation (app_id='s~logger'). App Engine service account has insufficient permissions for project. Developer or owner required.
1

1 Answers

0
votes

I got solution, actually I was thinking that [email protected] should be owner of project.

But I did not pay much attention to their words which were "App engine service account has insufficient permissions for project. Developer or owner required"

steps :

  1. Go to services accounts listing in developer console
  2. select "[email protected]", click on permissions.
  3. add [email protected] to new member and assign role as owner.

It solves problem