Aws-sam-cli: APIError: 500 Internal Server Error - Invalid volume specification

Created on 12 May 2018  Â·  16Comments  Â·  Source: aws/aws-sam-cli

Description:
APIError: 500 Server Error: Internal Server Error ("invalid volume specification: 'C:\Users\moleary\Workspace\personalaws-quiz-bot\lambda:/var/task:ro'")

OS Version:  
Windows 10 Pro 64-bit 
Docker Version: 
$ docker version
Client:
 Version:       18.03.0-ce
 API version:   1.37
 Go version:    go1.9.4
 Git commit:    0520e24302
 Built: Fri Mar 23 08:31:36 2018
 OS/Arch:       windows/amd64
 Experimental:  false
 Orchestrator:  swarm

Server:
 Engine:
  Version:      18.05.0-ce
  API version:  1.37 (minimum version 1.12)
  Go version:   go1.10.1
  Git commit:   f150324
  Built:        Wed May  9 22:20:42 2018
  OS/Arch:      linux/amd64
  Experimental: false

Steps to reproduce the issue:

  1. Create the template.yaml and the api.py file
  2. Issue the sam local start-api command
  3. Browser to http://127.0.0.1:3000

Observed result:
APIError: 500 Server Error: Internal Server Error ("invalid volume specification: 'C:\Users\moleary\Workspace\personalaws-quiz-bot\lambda:/var/task:ro'")

Expected result:
Downgrading to version 0.2.11 fixes the issue.

Additional environment details (Ex: Windows, Mac, Amazon Linux etc)

Output of sam --version:
C:\Users\moleary>sam --version
SAM CLI, version 0.3.0

Optional Debug logs:

Add --debug flag to command you are running

C:\Users\moleary\Workspace\personal\aws-quiz-bot\lambda>sam local start-api --debug
2018-05-12 22:29:49 local start-api command is called
2018-05-12 22:29:49 2 resources found in the template
2018-05-12 22:29:49 Found Serverless function with name='TestingFunction' and CodeUri='.'
2018-05-12 22:29:49 Trying paths: ['C:\\Users\\moleary\\.docker\\config.json', 'C:\\Users\\moleary\\.dockercfg']
2018-05-12 22:29:49 No config file found
2018-05-12 22:29:49 Trying paths: ['C:\\Users\\moleary\\.docker\\config.json', 'C:\\Users\\moleary\\.dockercfg']
2018-05-12 22:29:49 No config file found
2018-05-12 22:29:49 Starting new HTTPS connection (1): 192.168.99.100
2018-05-12 22:29:49 https://192.168.99.100:2376 "GET /v1.35/_ping HTTP/1.1" 200 2
2018-05-12 22:29:49 2 resources found in the template
2018-05-12 22:29:49 Found '1' API Events in Serverless function with name 'TestingFunction'
2018-05-12 22:29:49 Detected Inline Swagger definition
2018-05-12 22:29:49 Lambda function integration not found in Swagger document at path='/' method='get'
2018-05-12 22:29:49 Found '0' APIs in resource 'ServerlessRestApi'
2018-05-12 22:29:49 Removed duplicates from '0' Explicit APIs and '1' Implicit APIs to produce '1' APIs
2018-05-12 22:29:49 1 APIs found in the template
2018-05-12 22:29:49 Trying paths: ['C:\\Users\\moleary\\.docker\\config.json', 'C:\\Users\\moleary\\.dockercfg']
2018-05-12 22:29:49 No config file found
2018-05-12 22:29:49 Trying paths: ['C:\\Users\\moleary\\.docker\\config.json', 'C:\\Users\\moleary\\.dockercfg']
2018-05-12 22:29:49 No config file found
2018-05-12 22:29:49 Mounting TestingFunction at http://127.0.0.1:3000/ [GET]
2018-05-12 22:29:49 You can now browse to the above endpoints to invoke your functions. You do not need to restart/reload SAM CLI while working on your functions changes will be reflected instantly/automatically. You only need to restart SAM CLI if you update your AWS SAM template
2018-05-12 22:29:49 Local API Server starting up. Multi-threading = True
2018-05-12 22:29:49  * Running on http://127.0.0.1:3000/ (Press CTRL+C to quit)
2018-05-12 22:29:59 Constructed String representation of Event to invoke Lambda. Event: {"body": null, "httpMethod": "GET", "resource": "/", "queryStringParameters": null, "requestContext": {"httpMethod": "GET", "requestId": "c6af9ac6-7b61-11e6-9a41-93e8deadbeef", "path": "/", "extendedRequestId": null, "resourceId": "123456", "apiId": "1234567890", "stage": "prod", "resourcePath": "/", "identity": {"accountId": null, "apiKey": null, "userArn": null, "cognitoAuthenticationProvider": null, "cognitoIdentityPoolId": null, "userAgent": "Custom User Agent String", "caller": null, "cognitoAuthenticationType": null, "sourceIp": "127.0.0.1", "user": null}, "accountId": "123456789012"}, "headers": {"X-Forwarded-Port": "3000", "Host": "localhost:3000", "X-Forwarded-Proto": "http", "Accept": "*/*", "User-Agent": "curl/7.55.1"}, "stageVariables": null, "path": "/", "pathParameters": null, "isBase64Encoded": false}
2018-05-12 22:29:59 Found one Lambda function with name 'TestingFunction'
2018-05-12 22:29:59 Invoking api.lambda_handler (python3.6)
2018-05-12 22:29:59 No environment variables found for function 'TestingFunction'
2018-05-12 22:29:59 Environment variables overrides data is standard format
2018-05-12 22:29:59 Loading AWS credentials from session with profile 'None'
2018-05-12 22:29:59 Loading variable profile from defaults.
2018-05-12 22:29:59 Loading variable config_file from defaults.
2018-05-12 22:29:59 Loading variable credentials_file from defaults.
2018-05-12 22:29:59 Loading variable data_path from defaults.
2018-05-12 22:29:59 Loading variable profile from defaults.
2018-05-12 22:29:59 Loading variable credentials_file from defaults.
2018-05-12 22:29:59 Loading variable config_file from defaults.
2018-05-12 22:29:59 Loading variable profile from defaults.
2018-05-12 22:29:59 Loading variable metadata_service_timeout from defaults.
2018-05-12 22:29:59 Loading variable profile from defaults.
2018-05-12 22:29:59 Loading variable metadata_service_num_attempts from defaults.
2018-05-12 22:29:59 Loading variable profile from defaults.
2018-05-12 22:29:59 Looking for credentials via: env
2018-05-12 22:29:59 Found credentials in environment variables.
2018-05-12 22:29:59 Loading variable region from environment with value 'ap-southeast-2'.
2018-05-12 22:29:59 Loading variable region from environment with value 'ap-southeast-2'.
2018-05-12 22:29:59 Loading variable region from environment with value 'ap-southeast-2'.
2018-05-12 22:29:59 Resolving code path. Cwd=C:\Users\moleary\Workspace\personal\aws-quiz-bot\lambda, CodeUri=.
2018-05-12 22:29:59 Resolved absolute path to code is C:\Users\moleary\Workspace\personal\aws-quiz-bot\lambda
2018-05-12 22:29:59 Code C:\Users\moleary\Workspace\personal\aws-quiz-bot\lambda is not a zip/jar file
2018-05-12 22:29:59 Trying paths: ['C:\\Users\\moleary\\.docker\\config.json', 'C:\\Users\\moleary\\.dockercfg']
2018-05-12 22:29:59 No config file found
2018-05-12 22:29:59 Trying paths: ['C:\\Users\\moleary\\.docker\\config.json', 'C:\\Users\\moleary\\.dockercfg']
2018-05-12 22:29:59 No config file found
2018-05-12 22:29:59 Starting new HTTPS connection (1): 192.168.99.100
2018-05-12 22:29:59 https://192.168.99.100:2376 "GET /v1.35/images/lambci/lambda:python3.6/json HTTP/1.1" 200 None
2018-05-12 22:29:59 Looking for auth config
2018-05-12 22:29:59 No auth config in memory - loading from filesystem
2018-05-12 22:29:59 Trying paths: ['C:\\Users\\moleary\\.docker\\config.json', 'C:\\Users\\moleary\\.dockercfg']
2018-05-12 22:29:59 No config file found
2018-05-12 22:29:59 Looking for auth entry for 'docker.io'
2018-05-12 22:29:59 No entry found
2018-05-12 22:29:59 No auth config found
2018-05-12 22:30:02 https://192.168.99.100:2376 "POST /v1.35/images/create?tag=python3.6&fromImage=lambci%2Flambda HTTP/1.1" 200 None

Fetching lambci/lambda:python3.6 Docker container image......
2018-05-12 22:30:02 Mounting C:\Users\moleary\Workspace\personal\aws-quiz-bot\lambda as /var/task:ro inside runtime container
2018-05-12 22:30:02 Starting new HTTPS connection (1): 192.168.99.100
2018-05-12 22:30:02 https://192.168.99.100:2376 "POST /v1.35/containers/create HTTP/1.1" 500 121
2018-05-12 22:30:02 Container was not created. Skipping deletion
[2018-05-12 22:30:02,783] ERROR in app: Exception on / [GET]
Traceback (most recent call last):
  File "C:\Program Files\Python\Python27\lib\site-packages\flask\app.py", line 1982, in wsgi_app
    response = self.full_dispatch_request()
  File "C:\Program Files\Python\Python27\lib\site-packages\flask\app.py", line 1614, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "C:\Program Files\Python\Python27\lib\site-packages\flask\app.py", line 1517, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "C:\Program Files\Python\Python27\lib\site-packages\flask\app.py", line 1612, in full_dispatch_request
    rv = self.dispatch_request()
  File "C:\Program Files\Python\Python27\lib\site-packages\flask\app.py", line 1598, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "C:\Program Files\Python\Python27\lib\site-packages\samcli\local\apigw\service.py", line 161, in _request_handler
    self.lambda_runner.invoke(route.function_name, event, stdout=stdout_stream, stderr=self.stderr)
  File "C:\Program Files\Python\Python27\lib\site-packages\samcli\commands\local\lib\local_lambda.py", line 80, in invoke
    stdout=stdout, stderr=stderr)
  File "C:\Program Files\Python\Python27\lib\site-packages\samcli\local\lambdafn\runtime.py", line 83, in invoke
    self._container_manager.run(container)
  File "C:\Program Files\Python\Python27\lib\site-packages\samcli\local\docker\manager.py", line 61, in run
    container.create()
  File "C:\Program Files\Python\Python27\lib\site-packages\samcli\local\docker\container.py", line 110, in create
    real_container = self.docker_client.containers.create(self._image, **kwargs)
  File "C:\Program Files\Python\Python27\lib\site-packages\docker\models\containers.py", line 824, in create
    resp = self.client.api.create_container(**create_kwargs)
  File "C:\Program Files\Python\Python27\lib\site-packages\docker\api\container.py", line 410, in create_container
    return self.create_container_from_config(config, name)
  File "C:\Program Files\Python\Python27\lib\site-packages\docker\api\container.py", line 421, in create_container_from_config
    return self._result(res, True)
  File "C:\Program Files\Python\Python27\lib\site-packages\docker\api\client.py", line 231, in _result
    self._raise_for_status(response)
  File "C:\Program Files\Python\Python27\lib\site-packages\docker\api\client.py", line 227, in _raise_for_status
    raise create_api_error_from_http_exception(e)
  File "C:\Program Files\Python\Python27\lib\site-packages\docker\errors.py", line 31, in create_api_error_from_http_exception
    raise cls(e, response=response, explanation=explanation)
APIError: 500 Server Error: Internal Server Error ("invalid volume specification: 'C:\Users\moleary\Workspace\personal\aws-quiz-bot\lambda:/var/task:ro'")
2018-05-12 22:30:02 127.0.0.1 - - [12/May/2018 22:30:02] "GET / HTTP/1.1" 502 -

Setting code_abs_path to the following (in local_lambda.py) fixes on line 106 fixes the drive mounting issue, but the path is used elsewhere to mount the api.py file I have configured in the template. This then fails also

        # Implemented the follow hack for testing.
        code_abs_path = "/" + code_abs_path.lower().replace(
                '\\','/').replace(':','').lower()

Unable to import module 'api': No module named 'api'

```
C:\Users\moleary\Workspace\personalaws-quiz-bot\lambda>sam local start-api --debug
2018-05-12 22:39:27 local start-api command is called
2018-05-12 22:39:27 2 resources found in the template
2018-05-12 22:39:27 Found Serverless function with name='TestingFunction' and CodeUri='.'
2018-05-12 22:39:27 Trying paths: ['C:\Users\moleary\.docker\config.json', 'C:\Users\moleary\.dockercfg']
2018-05-12 22:39:27 No config file found
2018-05-12 22:39:27 Trying paths: ['C:\Users\moleary\.docker\config.json', 'C:\Users\moleary\.dockercfg']
2018-05-12 22:39:27 No config file found
2018-05-12 22:39:27 Starting new HTTPS connection (1): 192.168.99.100
2018-05-12 22:39:28 https://192.168.99.100:2376 "GET /v1.35/_ping HTTP/1.1" 200 2
2018-05-12 22:39:28 2 resources found in the template
2018-05-12 22:39:28 Found '1' API Events in Serverless function with name 'TestingFunction'
2018-05-12 22:39:28 Detected Inline Swagger definition
2018-05-12 22:39:28 Lambda function integration not found in Swagger document at path='/' method='get'
2018-05-12 22:39:28 Found '0' APIs in resource 'ServerlessRestApi'
2018-05-12 22:39:28 Removed duplicates from '0' Explicit APIs and '1' Implicit APIs to produce '1' APIs
2018-05-12 22:39:28 1 APIs found in the template
2018-05-12 22:39:28 Trying paths: ['C:\Users\moleary\.docker\config.json', 'C:\Users\moleary\.dockercfg']
2018-05-12 22:39:28 No config file found
2018-05-12 22:39:28 Trying paths: ['C:\Users\moleary\.docker\config.json', 'C:\Users\moleary\.dockercfg']
2018-05-12 22:39:28 No config file found
2018-05-12 22:39:28 Mounting TestingFunction at http://127.0.0.1:3000/ [GET]
2018-05-12 22:39:28 You can now browse to the above endpoints to invoke your functions. You do not need to restart/reload SAM CLI while working on your functions changes will be reflected instantly/automatically. You only need to restart SAM CLI if you update your AWS SAM template
2018-05-12 22:39:28 Local API Server starting up. Multi-threading = True
2018-05-12 22:39:28 * Running on http://127.0.0.1:3000/ (Press CTRL+C to quit)
2018-05-12 22:39:30 Constructed String representation of Event to invoke Lambda. Event: {"body": null, "httpMethod": "GET", "resource": "/", "queryStringParameters": null, "requestContext": {"httpMethod": "GET", "requestId": "c6af9ac6-7b61-11e6-9a41-93e8deadbeef", "path": "/", "extendedRequestId": null, "resourceId": "123456", "apiId": "1234567890", "stage": "prod", "resourcePath": "/", "identity": {"accountId": null, "apiKey": null, "userArn": null, "cognitoAuthenticationProvider": null, "cognitoIdentityPoolId": null, "userAgent": "Custom User Agent String", "caller": null, "cognitoAuthenticationType": null, "sourceIp": "127.0.0.1", "user": null}, "accountId": "123456789012"}, "headers": {"X-Forwarded-Port": "3000", "Host": "localhost:3000", "X-Forwarded-Proto": "http", "Accept": "/", "User-Agent": "curl/7.55.1"}, "stageVariables": null, "path": "/", "pathParameters": null, "isBase64Encoded": false}
2018-05-12 22:39:30 Found one Lambda function with name 'TestingFunction'
2018-05-12 22:39:30 Invoking api.lambda_handler (python3.6)
2018-05-12 22:39:30 No environment variables found for function 'TestingFunction'
2018-05-12 22:39:30 Environment variables overrides data is standard format
2018-05-12 22:39:30 Loading AWS credentials from session with profile 'None'
2018-05-12 22:39:30 Loading variable profile from defaults.
2018-05-12 22:39:30 Loading variable config_file from defaults.
2018-05-12 22:39:30 Loading variable credentials_file from defaults.
2018-05-12 22:39:30 Loading variable data_path from defaults.
2018-05-12 22:39:30 Loading variable profile from defaults.
2018-05-12 22:39:30 Loading variable credentials_file from defaults.
2018-05-12 22:39:30 Loading variable config_file from defaults.
2018-05-12 22:39:30 Loading variable profile from defaults.
2018-05-12 22:39:30 Loading variable metadata_service_timeout from defaults.
2018-05-12 22:39:30 Loading variable profile from defaults.
2018-05-12 22:39:30 Loading variable metadata_service_num_attempts from defaults.
2018-05-12 22:39:30 Loading variable profile from defaults.
2018-05-12 22:39:30 Looking for credentials via: env
2018-05-12 22:39:30 Found credentials in environment variables.
2018-05-12 22:39:30 Loading variable region from environment with value 'ap-southeast-2'.
2018-05-12 22:39:30 Loading variable region from environment with value 'ap-southeast-2'.
2018-05-12 22:39:30 Loading variable region from environment with value 'ap-southeast-2'.
2018-05-12 22:39:30 Resolving code path. Cwd=C:\Users\moleary\Workspace\personalaws-quiz-bot\lambda, CodeUri=.
2018-05-12 22:39:30 Resolved absolute path to code is /c/users/moleary/workspace/personal/aws-quiz-bot/lambda
2018-05-12 22:39:30 Code /c/users/moleary/workspace/personal/aws-quiz-bot/lambda is not a zip/jar file
2018-05-12 22:39:30 Trying paths: ['C:\Users\moleary\.docker\config.json', 'C:\Users\moleary\.dockercfg']
2018-05-12 22:39:30 No config file found
2018-05-12 22:39:30 Trying paths: ['C:\Users\moleary\.docker\config.json', 'C:\Users\moleary\.dockercfg']
2018-05-12 22:39:30 No config file found
2018-05-12 22:39:30 Starting new HTTPS connection (1): 192.168.99.100
2018-05-12 22:39:30 https://192.168.99.100:2376 "GET /v1.35/images/lambci/lambda:python3.6/json HTTP/1.1" 200 None
2018-05-12 22:39:30 Looking for auth config
2018-05-12 22:39:30 No auth config in memory - loading from filesystem
2018-05-12 22:39:30 Trying paths: ['C:\Users\moleary\.docker\config.json', 'C:\Users\moleary\.dockercfg']
2018-05-12 22:39:30 No config file found
2018-05-12 22:39:30 Looking for auth entry for 'docker.io'
2018-05-12 22:39:30 No entry found
2018-05-12 22:39:30 No auth config found
2018-05-12 22:39:34 https://192.168.99.100:2376 "POST /v1.35/images/create?tag=python3.6&fromImage=lambci%2Flambda HTTP/1.1" 200 None

Fetching lambci/lambda:python3.6 Docker container image......
2018-05-12 22:39:34 Mounting /c/users/moleary/workspace/personal/aws-quiz-bot/lambda as /var/task:ro inside runtime container
2018-05-12 22:39:34 Starting new HTTPS connection (1): 192.168.99.100
2018-05-12 22:39:34 https://192.168.99.100:2376 "POST /v1.35/containers/create HTTP/1.1" 201 90
2018-05-12 22:39:34 https://192.168.99.100:2376 "GET /v1.35/containers/9b8c08f660776b9d11fc96d265cf7969b4aa6902b3fab8a76bc0cd876c2af65f/json HTTP/1.1" 200 None
2018-05-12 22:39:34 https://192.168.99.100:2376 "GET /v1.35/containers/9b8c08f660776b9d11fc96d265cf7969b4aa6902b3fab8a76bc0cd876c2af65f/json HTTP/1.1" 200 None
2018-05-12 22:39:34 https://192.168.99.100:2376 "POST /v1.35/containers/9b8c08f660776b9d11fc96d265cf7969b4aa6902b3fab8a76bc0cd876c2af65f/start HTTP/1.1" 204 0
2018-05-12 22:39:34 Starting a timer for 3 seconds for function 'TestingFunction'
2018-05-12 22:39:34 https://192.168.99.100:2376 "GET /v1.35/containers/9b8c08f660776b9d11fc96d265cf7969b4aa6902b3fab8a76bc0cd876c2af65f/json HTTP/1.1" 200 None
2018-05-12 22:39:34 https://192.168.99.100:2376 "POST /containers/9b8c08f660776b9d11fc96d265cf7969b4aa6902b3fab8a76bc0cd876c2af65f/attach?stream=1&stdin=0&logs=1&stderr=1&stdout=1 HTTP/1.1" 101 0
START RequestId: b14fb7dd-8778-4222-addf-c8fa5b39d9e4 Version: $LATEST
Unable to import module 'api': No module named 'api'
END RequestId: b14fb7dd-8778-4222-addf-c8fa5b39d9e4
REPORT RequestId: b14fb7dd-8778-4222-addf-c8fa5b39d9e4 Duration: 1 ms Billed Duration: 100 ms Memory Size: 128 MB Max Memory Used: 18 MB
2018-05-12 22:39:35 Starting new HTTPS connection (2): 192.168.99.100
2018-05-12 22:39:35 https://192.168.99.100:2376 "GET /v1.35/containers/9b8c08f660776b9d11fc96d265cf7969b4aa6902b3fab8a76bc0cd876c2af65f/json HTTP/1.1" 200 None
2018-05-12 22:39:35 https://192.168.99.100:2376 "DELETE /v1.35/containers/9b8c08f660776b9d11fc96d265cf7969b4aa6902b3fab8a76bc0cd876c2af65f?force=True&link=False&v=False HTTP/1.1" 204 0
2018-05-12 22:39:35 No Content-Type given. Defaulting to 'application/json'.
2018-05-12 22:39:35 127.0.0.1 - - [12/May/2018 22:39:35] "GET / HTTP/1.1" 200 -```

Most helpful comment

May I request that the team _not_ ignore the issue, as it's still happening with Docker Toolkit?

All 16 comments

Thanks for reporting this!

On my mobile but this looks like a problem solvable with Pathlib over os
std lib due to some intricacies of OS path separators.
On Sat, 12 May 2018 at 13:52, michael-oleary notifications@github.com
wrote:

Description:
APIError: 500 Server Error: Internal Server Error ("invalid volume
specification:
'C:\Users\moleary\Workspace\personalaws-quiz-bot\lambda:/var/task:ro'")

OS Version:
Windows 10 Pro 64-bit

Docker Version:
$ docker version
Client:
Version: 18.03.0-ce
API version: 1.37
Go version: go1.9.4
Git commit: 0520e24302
Built: Fri Mar 23 08:31:36 2018
OS/Arch: windows/amd64
Experimental: false
Orchestrator: swarm

Server:
Engine:
Version: 18.05.0-ce
API version: 1.37 (minimum version 1.12)
Go version: go1.10.1
Git commit: f150324
Built: Wed May 9 22:20:42 2018
OS/Arch: linux/amd64
Experimental: false

Steps to reproduce the issue:

  1. Create the template.yaml and the api.py file
  2. Issue the sam local start-api command
  3. Browser to http://127.0.0.1:3000

Observed result:
APIError: 500 Server Error: Internal Server Error ("invalid volume
specification:
'C:\Users\moleary\Workspace\personalaws-quiz-bot\lambda:/var/task:ro'")

Expected result:
Downgrading to version 0.2.11 fixes the issue.

Additional environment details (Ex: Windows, Mac, Amazon Linux etc)

Output of sam --version:
C:\Users\moleary>sam --version
SAM CLI, version 0.3.0

Optional Debug logs:

Add --debug flag to command you are running

C:\Users\moleary\Workspace\personalaws-quiz-bot\lambda>sam local start-api --debug
2018-05-12 22:29:49 local start-api command is called
2018-05-12 22:29:49 2 resources found in the template
2018-05-12 22:29:49 Found Serverless function with name='TestingFunction' and CodeUri='.'
2018-05-12 22:29:49 Trying paths: ['C:\Users\moleary\.docker\config.json', 'C:\Users\moleary\.dockercfg']
2018-05-12 22:29:49 No config file found
2018-05-12 22:29:49 Trying paths: ['C:\Users\moleary\.docker\config.json', 'C:\Users\moleary\.dockercfg']
2018-05-12 22:29:49 No config file found
2018-05-12 22:29:49 Starting new HTTPS connection (1): 192.168.99.100
2018-05-12 22:29:49 https://192.168.99.100:2376 "GET /v1.35/_ping HTTP/1.1" 200 2
2018-05-12 22:29:49 2 resources found in the template
2018-05-12 22:29:49 Found '1' API Events in Serverless function with name 'TestingFunction'
2018-05-12 22:29:49 Detected Inline Swagger definition
2018-05-12 22:29:49 Lambda function integration not found in Swagger document at path='/' method='get'
2018-05-12 22:29:49 Found '0' APIs in resource 'ServerlessRestApi'
2018-05-12 22:29:49 Removed duplicates from '0' Explicit APIs and '1' Implicit APIs to produce '1' APIs
2018-05-12 22:29:49 1 APIs found in the template
2018-05-12 22:29:49 Trying paths: ['C:\Users\moleary\.docker\config.json', 'C:\Users\moleary\.dockercfg']
2018-05-12 22:29:49 No config file found
2018-05-12 22:29:49 Trying paths: ['C:\Users\moleary\.docker\config.json', 'C:\Users\moleary\.dockercfg']
2018-05-12 22:29:49 No config file found
2018-05-12 22:29:49 Mounting TestingFunction at http://127.0.0.1:3000/ [GET]
2018-05-12 22:29:49 You can now browse to the above endpoints to invoke your functions. You do not need to restart/reload SAM CLI while working on your functions changes will be reflected instantly/automatically. You only need to restart SAM CLI if you update your AWS SAM template
2018-05-12 22:29:49 Local API Server starting up. Multi-threading = True
2018-05-12 22:29:49 * Running on http://127.0.0.1:3000/ (Press CTRL+C to quit)
2018-05-12 22:29:59 Constructed String representation of Event to invoke Lambda. Event: {"body": null, "httpMethod": "GET", "resource": "/", "queryStringParameters": null, "requestContext": {"httpMethod": "GET", "requestId": "c6af9ac6-7b61-11e6-9a41-93e8deadbeef", "path": "/", "extendedRequestId": null, "resourceId": "123456", "apiId": "1234567890", "stage": "prod", "resourcePath": "/", "identity": {"accountId": null, "apiKey": null, "userArn": null, "cognitoAuthenticationProvider": null, "cognitoIdentityPoolId": null, "userAgent": "Custom User Agent String", "caller": null, "cognitoAuthenticationType": null, "sourceIp": "127.0.0.1", "user": null}, "accountId": "123456789012"}, "headers": {"X-Forwarded-Port": "3000", "Host": "localhost:3000", "X-Forwarded-Proto": "http", "Accept": "/", "User-Agent": "curl/7.55.1"}, "stageVariables": null, "path": "/", "pathParameters": null, "isBase64Encoded": false}
2018-05-12 22:29:59 Found one Lambda function with name 'TestingFunction'
2018-05-12 22:29:59 Invoking api.lambda_handler (python3.6)
2018-05-12 22:29:59 No environment variables found for function 'TestingFunction'
2018-05-12 22:29:59 Environment variables overrides data is standard format
2018-05-12 22:29:59 Loading AWS credentials from session with profile 'None'
2018-05-12 22:29:59 Loading variable profile from defaults.
2018-05-12 22:29:59 Loading variable config_file from defaults.
2018-05-12 22:29:59 Loading variable credentials_file from defaults.
2018-05-12 22:29:59 Loading variable data_path from defaults.
2018-05-12 22:29:59 Loading variable profile from defaults.
2018-05-12 22:29:59 Loading variable credentials_file from defaults.
2018-05-12 22:29:59 Loading variable config_file from defaults.
2018-05-12 22:29:59 Loading variable profile from defaults.
2018-05-12 22:29:59 Loading variable metadata_service_timeout from defaults.
2018-05-12 22:29:59 Loading variable profile from defaults.
2018-05-12 22:29:59 Loading variable metadata_service_num_attempts from defaults.
2018-05-12 22:29:59 Loading variable profile from defaults.
2018-05-12 22:29:59 Looking for credentials via: env
2018-05-12 22:29:59 Found credentials in environment variables.
2018-05-12 22:29:59 Loading variable region from environment with value 'ap-southeast-2'.
2018-05-12 22:29:59 Loading variable region from environment with value 'ap-southeast-2'.
2018-05-12 22:29:59 Loading variable region from environment with value 'ap-southeast-2'.
2018-05-12 22:29:59 Resolving code path. Cwd=C:\Users\moleary\Workspace\personalaws-quiz-bot\lambda, CodeUri=.
2018-05-12 22:29:59 Resolved absolute path to code is C:\Users\moleary\Workspace\personalaws-quiz-bot\lambda
2018-05-12 22:29:59 Code C:\Users\moleary\Workspace\personalaws-quiz-bot\lambda is not a zip/jar file
2018-05-12 22:29:59 Trying paths: ['C:\Users\moleary\.docker\config.json', 'C:\Users\moleary\.dockercfg']
2018-05-12 22:29:59 No config file found
2018-05-12 22:29:59 Trying paths: ['C:\Users\moleary\.docker\config.json', 'C:\Users\moleary\.dockercfg']
2018-05-12 22:29:59 No config file found
2018-05-12 22:29:59 Starting new HTTPS connection (1): 192.168.99.100
2018-05-12 22:29:59 https://192.168.99.100:2376 "GET /v1.35/images/lambci/lambda:python3.6/json HTTP/1.1" 200 None
2018-05-12 22:29:59 Looking for auth config
2018-05-12 22:29:59 No auth config in memory - loading from filesystem
2018-05-12 22:29:59 Trying paths: ['C:\Users\moleary\.docker\config.json', 'C:\Users\moleary\.dockercfg']
2018-05-12 22:29:59 No config file found
2018-05-12 22:29:59 Looking for auth entry for 'docker.io'
2018-05-12 22:29:59 No entry found
2018-05-12 22:29:59 No auth config found
2018-05-12 22:30:02 https://192.168.99.100:2376 "POST /v1.35/images/create?tag=python3.6&fromImage=lambci%2Flambda HTTP/1.1" 200 None

Fetching lambci/lambda:python3.6 Docker container image......
2018-05-12 22:30:02 Mounting C:\Users\moleary\Workspace\personalaws-quiz-bot\lambda as /var/task:ro inside runtime container
2018-05-12 22:30:02 Starting new HTTPS connection (1): 192.168.99.100
2018-05-12 22:30:02 https://192.168.99.100:2376 "POST /v1.35/containers/create HTTP/1.1" 500 121
2018-05-12 22:30:02 Container was not created. Skipping deletion
[2018-05-12 22:30:02,783] ERROR in app: Exception on / [GET]
Traceback (most recent call last):
File "C:\Program Files\Python\Python27lib\site-packages\flaskapp.py", line 1982, in wsgi_app
response = self.full_dispatch_request()
File "C:\Program Files\Python\Python27lib\site-packages\flaskapp.py", line 1614, in full_dispatch_request
rv = self.handle_user_exception(e)
File "C:\Program Files\Python\Python27lib\site-packages\flaskapp.py", line 1517, in handle_user_exception
reraise(exc_type, exc_value, tb)
File "C:\Program Files\Python\Python27lib\site-packages\flaskapp.py", line 1612, in full_dispatch_request
rv = self.dispatch_request()
File "C:\Program Files\Python\Python27lib\site-packages\flaskapp.py", line 1598, in dispatch_request
return self.view_functionsrule.endpoint
File "C:\Program Files\Python\Python27lib\site-packages\samcli\localapigw\service.py", line 161, in _request_handler
self.lambda_runner.invoke(route.function_name, event, stdout=stdout_stream, stderr=self.stderr)
File "C:\Program Files\Python\Python27lib\site-packages\samcli\commands\locallib\local_lambda.py", line 80, in invoke
stdout=stdout, stderr=stderr)
File "C:\Program Files\Python\Python27lib\site-packages\samcli\local\lambdafn\runtime.py", line 83, in invoke
self._container_manager.run(container)
File "C:\Program Files\Python\Python27lib\site-packages\samcli\local\docker\manager.py", line 61, in run
container.create()
File "C:\Program Files\Python\Python27lib\site-packages\samcli\local\docker\container.py", line 110, in create
real_container = self.docker_client.containers.create(self._image, kwargs)
File "C:\Program Files\Python\Python27lib\site-packages\docker\models\containers.py", line 824, in create
resp = self.client.api.create_container(
create_kwargs)
File "C:\Program Files\Python\Python27lib\site-packages\dockerapi\container.py", line 410, in create_container
return self.create_container_from_config(config, name)
File "C:\Program Files\Python\Python27lib\site-packages\dockerapi\container.py", line 421, in create_container_from_config
return self._result(res, True)
File "C:\Program Files\Python\Python27lib\site-packages\dockerapi\client.py", line 231, in _result
self._raise_for_status(response)
File "C:\Program Files\Python\Python27lib\site-packages\dockerapi\client.py", line 227, in _raise_for_status
raise create_api_error_from_http_exception(e)
File "C:\Program Files\Python\Python27lib\site-packages\dockererrors.py", line 31, in create_api_error_from_http_exception
raise cls(e, response=response, explanation=explanation)
APIError: 500 Server Error: Internal Server Error ("invalid volume specification: 'C:\Users\moleary\Workspace\personalaws-quiz-bot\lambda:/var/task:ro'")
2018-05-12 22:30:02 127.0.0.1 - - [12/May/2018 22:30:02] "GET / HTTP/1.1" 502 -

Setting code_abs_path to the following (in local_lambda.py) fixes on line
106 fixes the drive mounting issue, but the path is used elsewhere to mount
the api.py file I have configured in the template. This then fails also

    # Implemented the follow hack for testing.
    code_abs_path = "/" + code_abs_path.lower().replace(
            '\\','/').replace(':','').lower()

Unable to import module 'api': No module named 'api'

C:\Users\moleary\Workspace\personalaws-quiz-bot\lambda>sam local start-api --debug
2018-05-12 22:39:27 local start-api command is called
2018-05-12 22:39:27 2 resources found in the template
2018-05-12 22:39:27 Found Serverless function with name='TestingFunction' and CodeUri='.'
2018-05-12 22:39:27 Trying paths: ['C:\Users\moleary\.docker\config.json', 'C:\Users\moleary\.dockercfg']
2018-05-12 22:39:27 No config file found
2018-05-12 22:39:27 Trying paths: ['C:\Users\moleary\.docker\config.json', 'C:\Users\moleary\.dockercfg']
2018-05-12 22:39:27 No config file found
2018-05-12 22:39:27 Starting new HTTPS connection (1): 192.168.99.100
2018-05-12 22:39:28 https://192.168.99.100:2376 "GET /v1.35/_ping HTTP/1.1" 200 2
2018-05-12 22:39:28 2 resources found in the template
2018-05-12 22:39:28 Found '1' API Events in Serverless function with name 'TestingFunction'
2018-05-12 22:39:28 Detected Inline Swagger definition
2018-05-12 22:39:28 Lambda function integration not found in Swagger document at path='/' method='get'
2018-05-12 22:39:28 Found '0' APIs in resource 'ServerlessRestApi'
2018-05-12 22:39:28 Removed duplicates from '0' Explicit APIs and '1' Implicit APIs to produce '1' APIs
2018-05-12 22:39:28 1 APIs found in the template
2018-05-12 22:39:28 Trying paths: ['C:\Users\moleary\.docker\config.json', 'C:\Users\moleary\.dockercfg']
2018-05-12 22:39:28 No config file found
2018-05-12 22:39:28 Trying paths: ['C:\Users\moleary\.docker\config.json', 'C:\Users\moleary\.dockercfg']
2018-05-12 22:39:28 No config file found
2018-05-12 22:39:28 Mounting TestingFunction at http://127.0.0.1:3000/ [GET]
2018-05-12 22:39:28 You can now browse to the above endpoints to invoke your functions. You do not need to restart/reload SAM CLI while working on your functions changes will be reflected instantly/automatically. You only need to restart SAM CLI if you update your AWS SAM template
2018-05-12 22:39:28 Local API Server starting up. Multi-threading = True
2018-05-12 22:39:28 * Running on http://127.0.0.1:3000/ (Press CTRL+C to quit)
2018-05-12 22:39:30 Constructed String representation of Event to invoke Lambda. Event: {"body": null, "httpMethod": "GET", "resource": "/", "queryStringParameters": null, "requestContext": {"httpMethod": "GET", "requestId": "c6af9ac6-7b61-11e6-9a41-93e8deadbeef", "path": "/", "extendedRequestId": null, "resourceId": "123456", "apiId": "1234567890", "stage": "prod", "resourcePath": "/", "identity": {"accountId": null, "apiKey": null, "userArn": null, "cognitoAuthenticationProvider": null, "cognitoIdentityPoolId": null, "userAgent": "Custom User Agent String", "caller": null, "cognitoAuthenticationType": null, "sourceIp": "127.0.0.1", "user": null}, "accountId": "123456789012"}, "headers": {"X-Forwarded-Port": "3000", "Host": "localhost:3000", "X-Forwarded-Proto": "http", "Accept": "/", "User-Agent": "curl/7.55.1"}, "stageVariables": null, "path": "/", "pathParameters": null, "isBase64Encoded": false}
2018-05-12 22:39:30 Found one Lambda function with name 'TestingFunction'
2018-05-12 22:39:30 Invoking api.lambda_handler (python3.6)
2018-05-12 22:39:30 No environment variables found for function 'TestingFunction'
2018-05-12 22:39:30 Environment variables overrides data is standard format
2018-05-12 22:39:30 Loading AWS credentials from session with profile 'None'
2018-05-12 22:39:30 Loading variable profile from defaults.
2018-05-12 22:39:30 Loading variable config_file from defaults.
2018-05-12 22:39:30 Loading variable credentials_file from defaults.
2018-05-12 22:39:30 Loading variable data_path from defaults.
2018-05-12 22:39:30 Loading variable profile from defaults.
2018-05-12 22:39:30 Loading variable credentials_file from defaults.
2018-05-12 22:39:30 Loading variable config_file from defaults.
2018-05-12 22:39:30 Loading variable profile from defaults.
2018-05-12 22:39:30 Loading variable metadata_service_timeout from defaults.
2018-05-12 22:39:30 Loading variable profile from defaults.
2018-05-12 22:39:30 Loading variable metadata_service_num_attempts from defaults.
2018-05-12 22:39:30 Loading variable profile from defaults.
2018-05-12 22:39:30 Looking for credentials via: env
2018-05-12 22:39:30 Found credentials in environment variables.
2018-05-12 22:39:30 Loading variable region from environment with value 'ap-southeast-2'.
2018-05-12 22:39:30 Loading variable region from environment with value 'ap-southeast-2'.
2018-05-12 22:39:30 Loading variable region from environment with value 'ap-southeast-2'.
2018-05-12 22:39:30 Resolving code path. Cwd=C:\Users\moleary\Workspace\personalaws-quiz-bot\lambda, CodeUri=.
2018-05-12 22:39:30 Resolved absolute path to code is /c/users/moleary/workspace/personal/aws-quiz-bot/lambda
2018-05-12 22:39:30 Code /c/users/moleary/workspace/personal/aws-quiz-bot/lambda is not a zip/jar file
2018-05-12 22:39:30 Trying paths: ['C:\Users\moleary\.docker\config.json', 'C:\Users\moleary\.dockercfg']
2018-05-12 22:39:30 No config file found
2018-05-12 22:39:30 Trying paths: ['C:\Users\moleary\.docker\config.json', 'C:\Users\moleary\.dockercfg']
2018-05-12 22:39:30 No config file found
2018-05-12 22:39:30 Starting new HTTPS connection (1): 192.168.99.100
2018-05-12 22:39:30 https://192.168.99.100:2376 "GET /v1.35/images/lambci/lambda:python3.6/json HTTP/1.1" 200 None
2018-05-12 22:39:30 Looking for auth config
2018-05-12 22:39:30 No auth config in memory - loading from filesystem
2018-05-12 22:39:30 Trying paths: ['C:\Users\moleary\.docker\config.json', 'C:\Users\moleary\.dockercfg']
2018-05-12 22:39:30 No config file found
2018-05-12 22:39:30 Looking for auth entry for 'docker.io'
2018-05-12 22:39:30 No entry found
2018-05-12 22:39:30 No auth config found
2018-05-12 22:39:34 https://192.168.99.100:2376 "POST /v1.35/images/create?tag=python3.6&fromImage=lambci%2Flambda HTTP/1.1" 200 None

Fetching lambci/lambda:python3.6 Docker container image......
2018-05-12 22:39:34 Mounting /c/users/moleary/workspace/personal/aws-quiz-bot/lambda as /var/task:ro inside runtime container
2018-05-12 22:39:34 Starting new HTTPS connection (1): 192.168.99.100
2018-05-12 22:39:34 https://192.168.99.100:2376 "POST /v1.35/containers/create HTTP/1.1" 201 90
2018-05-12 22:39:34 https://192.168.99.100:2376 "GET /v1.35/containers/9b8c08f660776b9d11fc96d265cf7969b4aa6902b3fab8a76bc0cd876c2af65f/json HTTP/1.1" 200 None
2018-05-12 22:39:34 https://192.168.99.100:2376 "GET /v1.35/containers/9b8c08f660776b9d11fc96d265cf7969b4aa6902b3fab8a76bc0cd876c2af65f/json HTTP/1.1" 200 None
2018-05-12 22:39:34 https://192.168.99.100:2376 "POST /v1.35/containers/9b8c08f660776b9d11fc96d265cf7969b4aa6902b3fab8a76bc0cd876c2af65f/start HTTP/1.1" 204 0
2018-05-12 22:39:34 Starting a timer for 3 seconds for function 'TestingFunction'
2018-05-12 22:39:34 https://192.168.99.100:2376 "GET /v1.35/containers/9b8c08f660776b9d11fc96d265cf7969b4aa6902b3fab8a76bc0cd876c2af65f/json HTTP/1.1" 200 None
2018-05-12 22:39:34 https://192.168.99.100:2376 "POST /containers/9b8c08f660776b9d11fc96d265cf7969b4aa6902b3fab8a76bc0cd876c2af65f/attach?stream=1&stdin=0&logs=1&stderr=1&stdout=1 HTTP/1.1" 101 0
START RequestId: b14fb7dd-8778-4222-addf-c8fa5b39d9e4 Version: $LATEST
Unable to import module 'api': No module named 'api'
END RequestId: b14fb7dd-8778-4222-addf-c8fa5b39d9e4
REPORT RequestId: b14fb7dd-8778-4222-addf-c8fa5b39d9e4 Duration: 1 ms Billed Duration: 100 ms Memory Size: 128 MB Max Memory Used: 18 MB
2018-05-12 22:39:35 Starting new HTTPS connection (2): 192.168.99.100
2018-05-12 22:39:35 https://192.168.99.100:2376 "GET /v1.35/containers/9b8c08f660776b9d11fc96d265cf7969b4aa6902b3fab8a76bc0cd876c2af65f/json HTTP/1.1" 200 None
2018-05-12 22:39:35 https://192.168.99.100:2376 "DELETE /v1.35/containers/9b8c08f660776b9d11fc96d265cf7969b4aa6902b3fab8a76bc0cd876c2af65f?force=True&link=False&v=False HTTP/1.1" 204 0
2018-05-12 22:39:35 No Content-Type given. Defaulting to 'application/json'.
2018-05-12 22:39:35 127.0.0.1 - - [12/May/2018 22:39:35] "GET / HTTP/1.1" 200 -```

—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
https://github.com/awslabs/aws-sam-cli/issues/408, or mute the thread
https://github.com/notifications/unsubscribe-auth/ADL4BMmNhpnuSXX6tploEKMw5DulXesWks5txtr7gaJpZM4T8Zws
.

Thanks for the pointer, I'll do a fork of the repo if I get time in the next few days and test it out on my mac and windows box. I just implemented the quick hack for testing but downgraded to version 0.2.11 in the meantime to get the work done. I'll let you know how I get on.

Awesome - Here’s a great write up to get up to speed very quickly with
pathlib: https://realpython.com/python-pathlib/

happy to review/test/contribute anything you come up with
On Sun, 13 May 2018 at 12:45, michael-oleary notifications@github.com
wrote:

Thanks for the pointer, I'll do a fork of the repo if I get time in the
next few days and test it out on my mac and windows box. I just implemented
the quick hack for testing but downgraded to version 0.2.11 in the meantime
to get the work done. I'll let you know how I get on.

—
You are receiving this because you commented.

Reply to this email directly, view it on GitHub
https://github.com/awslabs/aws-sam-cli/issues/408#issuecomment-388620913,
or mute the thread
https://github.com/notifications/unsubscribe-auth/ADL4BDB6ZBGS33w4Rp96Loh-dHltSxvSks5tyBzxgaJpZM4T8Zws
.

Please ignore this issue it's only happening with Docker Toolkit, I've upgraded to Docker for Windows and it's working correctly.

Perfect! Thanks for the update Michael
On Mon, 14 May 2018 at 06:05, michael-oleary notifications@github.com
wrote:

Closed #408 https://github.com/awslabs/aws-sam-cli/issues/408.

—
You are receiving this because you commented.

Reply to this email directly, view it on GitHub
https://github.com/awslabs/aws-sam-cli/issues/408#event-1623945013, or mute
the thread
https://github.com/notifications/unsubscribe-auth/ADL4BNzyp-bFcsk9t2QFuhz83r4goOevks5tyRCvgaJpZM4T8Zws
.

May I request that the team _not_ ignore the issue, as it's still happening with Docker Toolkit?

I'm with @iKadmium about not ignoring this issue once Docker for Windows is available only for Windows 10 Pro and Enterprise x64. Another versions still need to make use of Docker Toolkit.

Well, I upgraded to v.0.3.0. Then I had to setup Python 2.7, because I had Python 3.4 installed and aws-sam-cli wants 2.7. And after that finally when I got aws-sam-cli running I found out that actually it is not going to work because of this mount problem. Moving to Windows 10 to start using Docker for Windows instead of Docker Toolkit seems too much for me for today. So for now I have to downgrade to old npm version of aws-sam-local. Are there any chances new version of aws-sam-cli will work with Docker Toolkit?

I used the sample project created by sam init.

Same issue here with the following installed on Windows 10 Pro Version 1803 Build 17134.112:

C:\Users\Daniel\Documents\Repos\TestProject\sam-app>sam local start-api
2018-06-19 10:22:11 Mounting HelloWorldFunction at http://127.0.0.1:3000/hello [GET]
2018-06-19 10:22:11 You can now browse to the above endpoints to invoke your functions. You do not need to restart/reload SAM CLI while working on your functions changes will be reflected instantly/automatically. You only need to restart SAM CLI if you update your AWS SAM template
2018-06-19 10:22:12  * Running on http://127.0.0.1:3000/ (Press CTRL+C to quit)
2018-06-19 10:22:13 Invoking app.lambda_handler (nodejs8.10)
[... Full stack trace below ...]
docker.errors.APIError: 500 Server Error: Internal Server Error ("invalid volume specification: 'C:\Users\Daniel\Documents\Repos\TestProject\sam-app\hello_world:/var/task:ro'")

$ docker --version
Docker version 18.03.0-ce, build 0520e24302

$ docker-machine --version
docker-machine.exe version 0.14.0, build 89b8332

$ python --version
Python 3.6.5

$ pip freeze
arrow==0.12.1
aws-sam-cli==0.4.0
aws-sam-translator==1.6.0
binaryornot==0.4.4
boto3==1.7.40
botocore==1.10.40
certifi==2018.4.16
chardet==3.0.4
click==6.7
cookiecutter==1.6.0
docker==3.4.0
docker-pycreds==0.3.0
docutils==0.14
enum34==1.1.6
Flask==1.0.2
future==0.16.0
idna==2.7
itsdangerous==0.24
Jinja2==2.10
jinja2-time==0.2.0
jmespath==0.9.3
jsonschema==2.6.0
MarkupSafe==1.0
poyo==0.4.1
pypiwin32==220
python-dateutil==2.7.3
PyYAML==3.12
requests==2.19.1
s3transfer==0.1.13
six==1.11.0
urllib3==1.23
websocket-client==0.48.0
Werkzeug==0.14.1
whichcraft==0.4.1

Stack trace:

C:\Users\Daniel\Documents\Repos\TestProject\sam-app>sam local start-api
2018-06-19 10:22:11 Mounting HelloWorldFunction at http://127.0.0.1:3000/hello [GET]
2018-06-19 10:22:11 You can now browse to the above endpoints to invoke your functions. You do not need to restart/reload SAM CLI while working on your functions changes will be reflected instantly/automatically. You only need to restart SAM CLI if you update your AWS SAM template
2018-06-19 10:22:12  * Running on http://127.0.0.1:3000/ (Press CTRL+C to quit)
2018-06-19 10:22:13 Invoking app.lambda_handler (nodejs8.10)
2018-06-19 10:22:13 Found credentials in shared credentials file: ~/.aws/credentials

Fetching lambci/lambda:nodejs8.10 Docker container image......
2018-06-19 10:22:14 Mounting C:\Users\Daniel\Documents\Repos\TestProject\sam-app\hello_world as /var/task:ro inside runtime container
2018-06-19 10:22:14 Exception on /hello [GET]
Traceback (most recent call last):
  File "C:\Users\Daniel\AppData\Roaming\Python\Python36\site-packages\docker\api\client.py", line 229, in _raise_for_status
    response.raise_for_status()
  File "C:\Users\Daniel\AppData\Roaming\Python\Python36\site-packages\requests\models.py", line 939, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 500 Server Error: Internal Server Error for url: https://192.168.99.100:2376/v1.35/containers/create

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\Daniel\AppData\Roaming\Python\Python36\site-packages\flask\app.py", line 2292, in wsgi_app
    response = self.full_dispatch_request()
  File "C:\Users\Daniel\AppData\Roaming\Python\Python36\site-packages\flask\app.py", line 1815, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "C:\Users\Daniel\AppData\Roaming\Python\Python36\site-packages\flask\app.py", line 1718, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "C:\Users\Daniel\AppData\Roaming\Python\Python36\site-packages\flask\_compat.py", line 35, in reraise
    raise value
  File "C:\Users\Daniel\AppData\Roaming\Python\Python36\site-packages\flask\app.py", line 1813, in full_dispatch_request
    rv = self.dispatch_request()
  File "C:\Users\Daniel\AppData\Roaming\Python\Python36\site-packages\flask\app.py", line 1799, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "C:\Users\Daniel\AppData\Roaming\Python\Python36\site-packages\samcli\local\apigw\service.py", line 185, in _request_handler
    self.lambda_runner.invoke(route.function_name, event, stdout=stdout_stream, stderr=self.stderr)
  File "C:\Users\Daniel\AppData\Roaming\Python\Python36\site-packages\samcli\commands\local\lib\local_lambda.py", line 80, in invoke
    stdout=stdout, stderr=stderr)
  File "C:\Users\Daniel\AppData\Roaming\Python\Python36\site-packages\samcli\local\lambdafn\runtime.py", line 83, in invoke
    self._container_manager.run(container)
  File "C:\Users\Daniel\AppData\Roaming\Python\Python36\site-packages\samcli\local\docker\manager.py", line 61, in run
    container.create()
  File "C:\Users\Daniel\AppData\Roaming\Python\Python36\site-packages\samcli\local\docker\container.py", line 110, in create
    real_container = self.docker_client.containers.create(self._image, **kwargs)
  File "C:\Users\Daniel\AppData\Roaming\Python\Python36\site-packages\docker\models\containers.py", line 824, in create
    resp = self.client.api.create_container(**create_kwargs)
  File "C:\Users\Daniel\AppData\Roaming\Python\Python36\site-packages\docker\api\container.py", line 410, in create_container
    return self.create_container_from_config(config, name)
  File "C:\Users\Daniel\AppData\Roaming\Python\Python36\site-packages\docker\api\container.py", line 421, in create_container_from_config
    return self._result(res, True)
  File "C:\Users\Daniel\AppData\Roaming\Python\Python36\site-packages\docker\api\client.py", line 235, in _result
    self._raise_for_status(response)
  File "C:\Users\Daniel\AppData\Roaming\Python\Python36\site-packages\docker\api\client.py", line 231, in _raise_for_status
    raise create_api_error_from_http_exception(e)
  File "C:\Users\Daniel\AppData\Roaming\Python\Python36\site-packages\docker\errors.py", line 31, in create_api_error_from_http_exception
    raise cls(e, response=response, explanation=explanation)
docker.errors.APIError: 500 Server Error: Internal Server Error ("invalid volume specification: 'C:\Users\Daniel\Documents\Repos\TestProject\sam-app\hello_world:/var/task:ro'")

@heitorlessa: Could this issue be re-opened? It is very much affecting new users.

I've also tried getting it to work with the new Docker for Windows, but without documentation I haven't figured how to get it talking to docker-machine.

Is this the same as #461? It seems like it is

@jfuss Thank you, I will copy my comment over there. Feel free to delete my comments on this issue.

I'm having this issue as well. I just installed sam cli (and sam local) yesterday.

$ sam local invoke HelloWorldFunction -e ./hello_world/event.json

docker.errors.APIError: 500 Server Error: Internal Server Error ("Get https://registry-1.docker.io/v2/lambci/lambda/manifests/nodejs8.10: unauthorized: incorrect username or password")

Update: running docker logout on command line fixed the issue

@krisalexander200 Your error is different: unauthorized: incorrect username or password"

Looks like you have missing creds somewhere for docker.

C:\Projects\api-gateway-lambda-test>docker version
Client:
 Version:       18.03.0-ce
 API version:   1.37
 Go version:    go1.9.4
 Git commit:    0520e24302
 Built: Fri Mar 23 08:31:36 2018
 OS/Arch:       windows/amd64
 Experimental:  false
 Orchestrator:  swarm

Server:
 Engine:
  Version:      18.06.0-ce
  API version:  1.38 (minimum version 1.12)
  Go version:   go1.10.3
  Git commit:   0ffa825
  Built:        Wed Jul 18 19:13:39 2018
  OS/Arch:      linux/amd64
  Experimental: false

C:\Projects\api-gateway-lambda-test>docker-machine --version
docker-machine version 0.14.0, build 89b8332

C:\Projects\api-gateway-lambda-test>python --version
Python 2.7.12

C:\Projects\api-gateway-lambda-test>pip --version
pip 18.0 from c:\python27\lib\site-packages\pip (python 2.7)

C:\Projects\api-gateway-lambda-test>sam --version
SAM CLI, version 0.5.0

C:\Projects\api-gateway-lambda-test>aws --version
aws-cli/1.16.1 Python/2.7.12 Windows/10 botocore/1.11.1

C:\Projects\api-gateway-lambda-test>sam local start-api
2018-08-27 17:15:46 Mounting HelloWorld at http://127.0.0.1:3000/ [GET]
2018-08-27 17:15:46 Mounting HelloWorld at http://127.0.0.1:3000/{proxy+} [GET]
2018-08-27 17:15:46 You can now browse to the above endpoints to invoke your functions. You do not need to restart/reload SAM CLI while working on your functions changes will be reflected instantly/automatically. You only need to restart SAM CLI if you update your AWS SAM template
2018-08-27 17:15:46  * Running on http://127.0.0.1:3000/ (Press CTRL+C to quit)
2018-08-27 17:15:54 Invoking build/server.handler (nodejs8.10)

Fetching lambci/lambda:nodejs8.10 Docker container image......
2018-08-27 17:15:58 Mounting C:\Projects\api-gateway-lambda-test as /var/task:ro inside runtime container
2018-08-27 17:15:58 Exception on / [GET]
Traceback (most recent call last):
  File "c:\python27\lib\site-packages\flask\app.py", line 2292, in wsgi_app
    response = self.full_dispatch_request()
  File "c:\python27\lib\site-packages\flask\app.py", line 1815, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "c:\python27\lib\site-packages\flask\app.py", line 1718, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "c:\python27\lib\site-packages\flask\app.py", line 1813, in full_dispatch_request
    rv = self.dispatch_request()
  File "c:\python27\lib\site-packages\flask\app.py", line 1799, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "c:\python27\lib\site-packages\samcli\local\apigw\local_apigw_service.py", line 140, in _request_handler
    self.lambda_runner.invoke(route.function_name, event, stdout=stdout_stream, stderr=self.stderr)
  File "c:\python27\lib\site-packages\samcli\commands\local\lib\local_lambda.py", line 80, in invoke
    stdout=stdout, stderr=stderr)
  File "c:\python27\lib\site-packages\samcli\local\lambdafn\runtime.py", line 83, in invoke
    self._container_manager.run(container)
  File "c:\python27\lib\site-packages\samcli\local\docker\manager.py", line 61, in run
    container.create()
  File "c:\python27\lib\site-packages\samcli\local\docker\container.py", line 110, in create
    real_container = self.docker_client.containers.create(self._image, **kwargs)
  File "c:\python27\lib\site-packages\docker\models\containers.py", line 824, in create
    resp = self.client.api.create_container(**create_kwargs)
  File "c:\python27\lib\site-packages\docker\api\container.py", line 411, in create_container
    return self.create_container_from_config(config, name)
  File "c:\python27\lib\site-packages\docker\api\container.py", line 422, in create_container_from_config
    return self._result(res, True)
  File "c:\python27\lib\site-packages\docker\api\client.py", line 235, in _result
    self._raise_for_status(response)
  File "c:\python27\lib\site-packages\docker\api\client.py", line 231, in _raise_for_status
    raise create_api_error_from_http_exception(e)
  File "c:\python27\lib\site-packages\docker\errors.py", line 31, in create_api_error_from_http_exception
    raise cls(e, response=response, explanation=explanation)
APIError: 500 Server Error: Internal Server Error ("invalid volume specification: 'C:\Projects\api-gateway-lambda-test:/var/task:ro'")
2018-08-27 17:15:58 127.0.0.1 - - [27/Aug/2018 17:15:58] "GET / HTTP/1.1" 502 -
2018-08-27 17:15:58 Invoking build/server.handler (nodejs8.10)

Fetching lambci/lambda:nodejs8.10 Docker container image......
2018-08-27 17:16:02 Mounting C:\Projects\api-gateway-lambda-test as /var/task:ro inside runtime container
2018-08-27 17:16:02 Exception on /favicon.ico [GET]
Traceback (most recent call last):
  File "c:\python27\lib\site-packages\flask\app.py", line 2292, in wsgi_app
    response = self.full_dispatch_request()
  File "c:\python27\lib\site-packages\flask\app.py", line 1815, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "c:\python27\lib\site-packages\flask\app.py", line 1718, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "c:\python27\lib\site-packages\flask\app.py", line 1813, in full_dispatch_request
    rv = self.dispatch_request()
  File "c:\python27\lib\site-packages\flask\app.py", line 1799, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "c:\python27\lib\site-packages\samcli\local\apigw\local_apigw_service.py", line 140, in _request_handler
    self.lambda_runner.invoke(route.function_name, event, stdout=stdout_stream, stderr=self.stderr)
  File "c:\python27\lib\site-packages\samcli\commands\local\lib\local_lambda.py", line 80, in invoke
    stdout=stdout, stderr=stderr)
  File "c:\python27\lib\site-packages\samcli\local\lambdafn\runtime.py", line 83, in invoke
    self._container_manager.run(container)
  File "c:\python27\lib\site-packages\samcli\local\docker\manager.py", line 61, in run
    container.create()
  File "c:\python27\lib\site-packages\samcli\local\docker\container.py", line 110, in create
    real_container = self.docker_client.containers.create(self._image, **kwargs)
  File "c:\python27\lib\site-packages\docker\models\containers.py", line 824, in create
    resp = self.client.api.create_container(**create_kwargs)
  File "c:\python27\lib\site-packages\docker\api\container.py", line 411, in create_container
    return self.create_container_from_config(config, name)
  File "c:\python27\lib\site-packages\docker\api\container.py", line 422, in create_container_from_config
    return self._result(res, True)
  File "c:\python27\lib\site-packages\docker\api\client.py", line 235, in _result
    self._raise_for_status(response)
  File "c:\python27\lib\site-packages\docker\api\client.py", line 231, in _raise_for_status
    raise create_api_error_from_http_exception(e)
  File "c:\python27\lib\site-packages\docker\errors.py", line 31, in create_api_error_from_http_exception
    raise cls(e, response=response, explanation=explanation)
APIError: 500 Server Error: Internal Server Error ("invalid volume specification: 'C:\Projects\api-gateway-lambda-test:/var/task:ro'")
2018-08-27 17:16:02 127.0.0.1 - - [27/Aug/2018 17:16:02] "GET /favicon.ico HTTP/1.1" 502 -

just installed aws-sam-cli has this issue

I'm also facing the same issue running Windows Containers with experimental features enabled. I switched back to use Linux Containers and started working. Hope that helps

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ericallam picture ericallam  Â·  24Comments

chrisfosterelli picture chrisfosterelli  Â·  31Comments

uvaisTrivecta picture uvaisTrivecta  Â·  40Comments

enghwa picture enghwa  Â·  25Comments

charsleysa picture charsleysa  Â·  33Comments