0

I'm trying to deploy App Engine service to Standard Environment using Eclipse and Cloud Tools For Eclipse but when I add a .p12 file to war subfolder I'm receiving following error:

gcloud crashed (MultiError): One or more errors occurred:
last_result=(None, (<class 'apitools.base.py.exceptions.InvalidUserInputError'>, InvalidUserInputError('Invalid MIME type: "x-pkcs12"',), <traceback object at 0x00000000063755C8>)), last_retrial=3, time_passed_ms=33,time_to_wait=0

There is also following info in console:

{"timestamp": "2018-04-04T13:14:32.580Z", "verbosity": "ERROR", "version": "0.0.1", "message": "gcloud crashed (MultiError): One or more errors occurred:\nlast_result=(None, (<class 'apitools.base.py.exceptions.InvalidUserInputError'>, InvalidUserInputError('Invalid MIME type: \"x-pkcs12\"',), <traceback object at 0x000000000771EE48>)), last_retrial=3, time_passed_ms=37,time_to_wait=0"}

Eclipse Version: Oxygen.1a Release (4.7.1a)
Google Cloud Tools for Eclipse 1.6.0

What can be reason of this error? Should I perform some additional steps to upload .p12 file to App Engine app?
Without .p12 file every deploy finishes successfully but I have to use this file when working with Service Account

user
  • 65
  • 7
  • 2
    What is the version of gcloud you are using? Is it up to date? If you are not on Windows, what is the version of your python? Can you also retry after renaming the ".p12" extension to ".pfx" and see if you still see the error "Invalid MIME type: x-pkcs12"`? – Chanseok Oh Apr 05 '18 at 03:37
  • Renaming extension to ".pfx" resolved the issue. Thanks a lot! – user Apr 05 '18 at 08:42
  • Just in case, why are you uploading a .p12 file? Unless you have a special requirement, usually you'll want to use the service account provided by the App Engine runtime on prod. For example, in common situations, you let API calls automatically pick up the App Engine service account. In any case, make sure you never expose the .p12 file (since you said you put it in a war subfolder). – Chanseok Oh Apr 05 '18 at 14:41
  • I'm using service account with domain-wide delegation to call Google APIs. Is it proper approach? Folder with this file has restricted access defined in web.xml that only admins have access to it. – user Apr 05 '18 at 19:31

1 Answers1

2

There seems to exist some Python version with a bad mimetypes library. It returns x-pkcs12 in place of application/x-pkcs12 for .p12 files.

https://issuetracker.google.com/35906610

I expect using the latest Python version or a different implementation will fix the issue.

In your case, I think either your Cloud SDK is too old or your Python runtime on your system that the Cloud SDK is picking up has the bad mimetypes library.

Chanseok Oh
  • 3,920
  • 4
  • 23
  • 63