1
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

GCPデプロイ時エラーの解決方法

1
Last updated at Posted at 2020-04-29

はじめに

GCPでデプロイしようと思ったらエラーを吐かれて、結構悩まされた後解決したので書きました。

エラー内容

$ gcloud app deploy
ERROR: (gcloud.app.deploy) An error occurred while parsing file:
[/home/username/projectname/app.yaml]
Unknown url handler type.
<URLMap
    secure=default
    static_files=None
    application_readable=None
    auth_fail_action=redirect
    require_matching_file=None
    static_dir=None
    redirect_http_response_code=None
    http_headers=None
    url=/
runtime: python27
    script=None
    upload=None
    api_endpoint=None
    expiration=None
    position=None
    login=optional
    mime_type=None
    >

解決策

変更前

app.yaml
runtime: python27
api_version: 1
threadsafe: true
handlers:
- url: /
 static_files: mail/index.html
 upload: mail/index.html
- url: /
static_dir: mail

変更後

app.yaml
runtime: python27
api_version: 1
threadsafe: true
handlers:
- url: /
  static_files: dirname/index.html
  upload: dirname/index.html
- url: /
  static_dir: dirname

お気づきでしょうか、、? そう、6,7,9行目の最初にスペースを追加しただけです。たったこれだけのためにあんなに悩まされたのかチクショウ! yamlはこういうところめんどくさいですね。

※GCPにアップロードしたapp.yamlファイルを直接編集するか、ローカルのapp.yamlファイルを編集した後に再アップロードすることをお忘れなく。

おわりに

GCPデプロイの手順についてはこちらのサイトがおそらく一番わかりやすいかと思います。
https://medium.com/@karthiksagar/how-to-deploy-angular-8-app-on-google-cloud-platform-gcp-cdd79e5cc5cf

1
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?