google-app-enginegodev-appserver

InvalidAppConfigError: Duplicate module: my-service


My computer (Windows 10) hosting my VM (Ubuntu 16.04) restarted last night (because Windows is a jerk) and now I can't seem to run my service locally. This was running fine yesterday and I haven't changed a single line of code. Only thing that happened was the reboot.

I am running dev_appserver.py ./ app.yaml.

My app.yaml file:

runtime: go
api_version: go1
service: my-service

handlers:
- url: /.*
  script: _go_app

#[START env_variables]
env_variables:
 GCLOUD_STORAGE_BUCKET: my-cloud-bucket
#[END env_variables]

and the error I get is:

Traceback (most recent call last):
  File "/usr/lib/google-cloud-sdk/platform/google_appengine/dev_appserver.py", line 103, in <module>
    _run_file(__file__, globals())
  File "/usr/lib/google-cloud-sdk/platform/google_appengine/dev_appserver.py", line 97, in _run_file
    execfile(_PATHS.script_file(script_name), globals_)
  File "/usr/lib/google-cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/devappserver2.py", line 350, in <module>
    main()
  File "/usr/lib/google-cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/devappserver2.py", line 338, in main
    dev_server.start(options)
  File "/usr/lib/google-cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/devappserver2.py", line 94, in start
    env_variables=parsed_env_variables)
  File "/usr/lib/google-cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/application_configuration.py", line 953, in __init__
    module.module_name)
google.appengine.tools.devappserver2.errors.InvalidAppConfigError: Duplicate >module: my-service

Any advice?


Solution

  • You shouldn't need to specify both the application directory (./ in your case) and the app.yaml simultaneously. From Running the local development server:

    Specify the directory path to your app, for example:

    dev_appserver.py [PATH_TO_YOUR_APP]
    

    Alternatively, you can specify the configuration file of a specific service, for example:

    dev_appserver.py app.yaml
    

    Most likely the server detects the app.yaml from the directory specification and then gets it again from the app.yaml specification, leading to the duplicate service error.

    I'd simply drop the ./ directory specification from the command line (I'd rather not rely on the auto-detection, which can fail miserably for multi-service apps).