Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google App Engine "Error parsing ./app.yaml: Unknown url handler type"

I'm following a tutorial on how to install PHPMyAdmin on Google App Engine and I followed the directions exactly and when I go to push the app, I'm getting a parsing error. This is the tutorial link: https://gae-php-tips.appspot.com/2013/05/26/setting-up-phpmyadmin-on-app-engine/

I searched out Stackoverfllow and found some questions with the same error, and almost everyone said their is an indention issue that causes it, but I have reviewed my file several times an have not found any indentations in the app.yaml file.

This is my app.yaml file

application: phpmyadmin2121
version: phpmyadmin
runtime: php
api_version: 1

handlers:
- url: /(.*\.(ico$|jpg$|png$|gif$))
static_files: phpMyAdmin/\1
upload: phpMyAdmin/(.*\.(ico$|jpg$|png$|gif$))
application_readable: true

- url: /(.*\.(htm$|html$|css$|js$))
static_files: phpMyAdmin/\1
upload: phpMyAdmin/(.*\.(htm$|html$|css$|js$))
application_readable: true

- url: /(.*\.(php$))
script: phpMyAdmin/\1
secure: always
login: admin

- url: /(.+)
script: phpMyAdmin/index.php
secure: always
login: admin

- url: /
script: phpMyAdmin/index.php
secure: always
login: admin

Here is the command line prompt showing the error:

Michaels-MacBook-Air:phpMyAdmin Mike$ appcfg.py -R -A phpmyadmin2121 -V phpmyadmin update . Usage: appcfg.py [options] update | [file, ...]

appcfg.py: error: Error parsing ./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=/(.*\.(ico$|jpg$|png$|gif$)) 
    script=None 
    upload=None 
    api_endpoint=None 
    expiration=None 
    position=None 
    login=optional 
    mime_type=None
    >
  in "./app.yaml", line 8, column 1
like image 587
Michael Falciglia Avatar asked Aug 22 '14 19:08

Michael Falciglia


4 Answers

In case anyone else comes across this, I had the same issue. You must add TWO spaces for all subdirectories. Make sure the words are in line with "url".

Doesn't work:

- url: /
script: phpMyAdmin/index.php
secure: always
login: admin

Doesn't work:

- url: /
 script: phpMyAdmin/index.php
 secure: always
 login: admin

WORKS:

- url: /
  script: phpMyAdmin/index.php
  secure: always
  login: admin

Also, change the line to update the app from this:

appcfg.py -R -A my_application_id -V phpmyadmin update .

To this:

appcfg.py --oauth2 -R -A my_application_id -V phpmyadmin update .

For some odd reason, the first command asks for your email and password (my personal email didn't work). Using the second command with the --oauth2 option just works.

like image 190
Katrina Avatar answered Nov 16 '22 04:11

Katrina


In my case, it was not a whitespace issue.

I originally had the app.yaml file:

runtime: nodejs12

handlers:
- url: /.*
  secure: always

... more handlers here ...

which produced the error when deploying

Unknown url handler type.
<URLMap 
    secure=always
    ...
    >

The docs at https://cloud.google.com/appengine/docs/standard/nodejs/config/appref#handlers_element indicated that I was missing script: auto in my handler element.

In order to use static handlers, at least one of your handlers must contain the line script: auto or define an entrypoint element to deploy successfully.

So I updated my app.yaml:

runtime: nodejs12

handlers:
- url: /.*
  secure: always
  script: auto

... more handlers here ...

which deploys successfully.

like image 34
nishanthshanmugham Avatar answered Nov 16 '22 04:11

nishanthshanmugham


Try adding a space for any sub item. PHP uses the same parser as python. In python white space is used to denote blocks.

application: phpmyadmin2121
version: phpmyadmin
runtime: php
api_version: 1

handlers:
- url: /(.*\.(ico$|jpg$|png$|gif$))
  static_files: phpMyAdmin/\1
  upload: phpMyAdmin/(.*\.(ico$|jpg$|png$|gif$))
  application_readable: true

- url: /(.*\.(htm$|html$|css$|js$))
  static_files: phpMyAdmin/\1
  upload: phpMyAdmin/(.*\.(htm$|html$|css$|js$))
  application_readable: true

- url: /(.*\.(php$))
  script: phpMyAdmin/\1
  secure: always
  login: admin

- url: /(.+)
  script: phpMyAdmin/index.php
  secure: always
  login: admin

- url: /
  script: phpMyAdmin/index.php
  secure: always
  login: admin
like image 42
Ryan Avatar answered Nov 16 '22 03:11

Ryan


I had the same issue. The mistake in the tutorial are indeed the two missing spaces on the rows below the dash, so change from

handlers:
- url: /(.*\.(ico$|jpg$|png$|gif$))
static_files: phpMyAdmin/\1
upload: phpMyAdmin/(.*\.(ico$|jpg$|png$|gif$))

...

to

handlers:
- url: /(.*\.(ico$|jpg$|png$|gif$))
  static_files: phpMyAdmin/\1
  upload: phpMyAdmin/(.*\.(ico$|jpg$|png$|gif$))

...

like image 2
Anders Avatar answered Nov 16 '22 05:11

Anders