Hi i have a sam application which one lambda function and can be invoked from rest endpoint which is working as expected but when i try to test the sam application locally using sam local start-lambda or sam local start-api or sam local invoke i get the error as :
self.connect()
File "C:\Users\divyanayan.awasthi\AppData\Roaming\Python\Python37\site-packages\docker\transport\npipeconn.py", line 31, in connect
sock.connect(self.npipe_path)
File "C:\Users\divyanayan.awasthi\AppData\Roaming\Python\Python37\site-packages\docker\transport\npipesocket.py", line 22, in wrapped
return f(self, *args, **kwargs)
File "C:\Users\divyanayan.awasthi\AppData\Roaming\Python\Python37\site-packages\docker\transport\npipesocket.py", line 50, in connect
win32pipe.WaitNamedPipe(address, self._timeout)
pywintypes.error: (2, 'WaitNamedPipe', 'The system cannot find the file specified.')
Sam version used
SAM CLI, version 0.7.0
Is this because i dont have a docker running in my local or some other configuration is required .i have one .py class and template.yml file for SAM application.
Allows you to run your serverless application locally for quick development and testing. When you run this command in a directory that contains your serverless functions and your AWS SAM template, it creates a local HTTP server that hosts all of your functions.
You can use the AWS SAM CLI to locally test your AWS CDK applications by running the following commands from the project root directory of your AWS CDK application: sam local invoke. sam local start-api. sam local start-lambda.
You can invoke your AWS Lambda function locally by using the sam local invoke AWS SAM CLI command and providing the function's logical ID and an event file. Alternatively, sam local invoke also accepts stdin as an event. For more information about events, see Event in the AWS Lambda Developer Guide.
Yes we need to install docker locally then sam local works as expected .if you are running sam local on windows then there might a problem to install docker installer as it needs Windows 10 Pro or enterpise version to install.
In case you dont have the above windows configuration then install docker toolbox
https://docs.docker.com/toolbox/toolbox_install_windows/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With