Skip to content

Bug: az webapp new - errors if missing node engine version in package.json #73

@anthonychu

Description

@anthonychu

Extension name (the extension in question)

webapp

Description of issue (in as much detail as possible)

Many package.json files do not specify a node engine version. This value needs to have a default.

Repro:

bash-4.3# git clone https://github.com/scotch-io/node-todo.git
Cloning into 'node-todo'...
remote: Counting objects: 464, done.
remote: Total 464 (delta 0), reused 0 (delta 0), pack-reused 464
Receiving objects: 100% (464/464), 61.07 KiB | 0 bytes/s, done.
Resolving deltas: 100% (163/163), done.
Checking connectivity... done.
bash-4.3# cd node-todo/
bash-4.3# ls
README.md     README_es.md  app           config        license       package.json  public        server.js
bash-4.3# az webapp new -n test-node-todo
list index out of range
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/knack/cli.py", line 194, in invoke
    cmd_result = self.invocation.execute(args)
  File "/usr/local/lib/python3.6/site-packages/azure/cli/core/commands/__init__.py", line 331, in execute
    six.reraise(*sys.exc_info())
  File "/usr/local/lib/python3.6/site-packages/six.py", line 693, in reraise
    raise value
  File "/usr/local/lib/python3.6/site-packages/azure/cli/core/commands/__init__.py", line 304, in execute
    result = cmd(params)
  File "/usr/local/lib/python3.6/site-packages/azure/cli/core/commands/__init__.py", line 168, in __call__
    return super(AzCliCommand, self).__call__(*args, **kwargs)
  File "/usr/local/lib/python3.6/site-packages/knack/commands.py", line 109, in __call__
    return self.handler(*args, **kwargs)
  File "/usr/local/lib/python3.6/site-packages/azure/cli/core/__init__.py", line 348, in default_command_handler
    result = op(**command_args)
  File "/root/.azure/cliextensions/webapp/azext_webapp/custom.py", line 64, in create_deploy_webapp
    data = get_runtime_version_details(lang_details.get('file_loc'), language)
  File "/root/.azure/cliextensions/webapp/azext_webapp/create_util.py", line 61, in get_runtime_version_details
    version_detected = parse_node_version(file_path)[0]
IndexError: list index out of range
bash-4.3# 

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions