Bug: unable to use start-api on Manjaro
See original GitHub issueDescription:
Running sam local start-api
fails with a KeyError caused by the Werkzeug dependency. I’ve noticed the issue on Linux (Manjaro), it seems to work normally on Mac.
As a temporary workaround, I’ve downgraded Werkzeug to v2.0.0 on my computer. Anything starting 2.1.0 stops working.
Steps to reproduce:
- Initialize a basic project with
sam init
, using the following options:
- AWS Quick Start Templates
- Serverless API
- nodejs16.x
- Inside the newly created project, run
sam local start-api
Observed result:
2022-05-27 13:46:44,011 | Telemetry endpoint configured to be https://aws-serverless-tools-telemetry.us-west-2.amazonaws.com/metrics
2022-05-27 13:46:44,011 | Using config file: samconfig.toml, config environment: default
2022-05-27 13:46:44,011 | Expand command line arguments to:
2022-05-27 13:46:44,011 | --template_file=/home/carole/Documents/code/playgrounds/aws-sam-test/.aws-sam/build/template.yaml --host=127.0.0.1 --port=3000 --static_dir=public --layer_cache_basedir=/home/carole/.aws-sam/layers-pkg --container_host=localhost --container_host_interface=127.0.0.1
2022-05-27 13:46:44,048 | local start-api command is called
2022-05-27 13:46:44,054 | No Parameters detected in the template
2022-05-27 13:46:44,061 | Sam customer defined id is more priority than other IDs. Customer defined id for resource getAllItemsFunction is getAllItemsFunction
2022-05-27 13:46:44,061 | Sam customer defined id is more priority than other IDs. Customer defined id for resource getByIdFunction is getByIdFunction
2022-05-27 13:46:44,061 | Sam customer defined id is more priority than other IDs. Customer defined id for resource putItemFunction is putItemFunction
2022-05-27 13:46:44,061 | There is no customer defined id or cdk path defined for resource SampleTable, so we will use the resource logical id as the resource id
2022-05-27 13:46:44,061 | There is no customer defined id or cdk path defined for resource ServerlessRestApi, so we will use the resource logical id as the resource id
2022-05-27 13:46:44,062 | 0 stacks found in the template
2022-05-27 13:46:44,062 | No Parameters detected in the template
2022-05-27 13:46:44,068 | Sam customer defined id is more priority than other IDs. Customer defined id for resource getAllItemsFunction is getAllItemsFunction
2022-05-27 13:46:44,068 | Sam customer defined id is more priority than other IDs. Customer defined id for resource getByIdFunction is getByIdFunction
2022-05-27 13:46:44,068 | Sam customer defined id is more priority than other IDs. Customer defined id for resource putItemFunction is putItemFunction
2022-05-27 13:46:44,068 | There is no customer defined id or cdk path defined for resource SampleTable, so we will use the resource logical id as the resource id
2022-05-27 13:46:44,068 | There is no customer defined id or cdk path defined for resource ServerlessRestApi, so we will use the resource logical id as the resource id
2022-05-27 13:46:44,069 | 5 resources found in the stack
2022-05-27 13:46:44,069 | Found Serverless function with name='getAllItemsFunction' and CodeUri='getAllItemsFunction'
2022-05-27 13:46:44,069 | --base-dir is not presented, adjusting uri getAllItemsFunction relative to /home/carole/Documents/code/playgrounds/aws-sam-test/.aws-sam/build/template.yaml
2022-05-27 13:46:44,069 | Found Serverless function with name='getByIdFunction' and CodeUri='getByIdFunction'
2022-05-27 13:46:44,069 | --base-dir is not presented, adjusting uri getByIdFunction relative to /home/carole/Documents/code/playgrounds/aws-sam-test/.aws-sam/build/template.yaml
2022-05-27 13:46:44,069 | Found Serverless function with name='putItemFunction' and CodeUri='putItemFunction'
2022-05-27 13:46:44,069 | --base-dir is not presented, adjusting uri putItemFunction relative to /home/carole/Documents/code/playgrounds/aws-sam-test/.aws-sam/build/template.yaml
2022-05-27 13:46:44,076 | Found '1' API Events in Serverless function with name 'getAllItemsFunction'
2022-05-27 13:46:44,076 | Found '1' API Events in Serverless function with name 'getByIdFunction'
2022-05-27 13:46:44,076 | Found '1' API Events in Serverless function with name 'putItemFunction'
2022-05-27 13:46:44,076 | Detected Inline Swagger definition
2022-05-27 13:46:44,076 | Lambda function integration not found in Swagger document at path='/' method='post'
2022-05-27 13:46:44,076 | Lambda function integration not found in Swagger document at path='/' method='get'
2022-05-27 13:46:44,076 | Lambda function integration not found in Swagger document at path='/{id}' method='get'
2022-05-27 13:46:44,076 | Found '0' APIs in resource 'ServerlessRestApi'
2022-05-27 13:46:44,076 | Removed duplicates from '0' Explicit APIs and '3' Implicit APIs to produce '3' APIs
2022-05-27 13:46:44,076 | 3 APIs found in the template
2022-05-27 13:46:44,104 | Mounting putItemFunction at http://127.0.0.1:3000/ [POST]
2022-05-27 13:46:44,104 | Mounting getByIdFunction at http://127.0.0.1:3000/{id} [GET]
2022-05-27 13:46:44,104 | Mounting getAllItemsFunction at http://127.0.0.1:3000/ [GET]
2022-05-27 13:46:44,104 | 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
2022-05-27 13:46:44,104 | Localhost server is starting up. Multi-threading = True
2022-05-27 13:46:44,105 | Sending Telemetry: {'metrics': [{'commandRun': {'requestId': '8088616b-2b4f-4039-b772-4fe3c2ae81f2', 'installationId': '1bf7fb5b-51a3-4d5f-a674-69f79dcbe362', 'sessionId': 'd2b3fad1-4de2-422b-a355-c8a75f72f621', 'executionEnvironment': 'CLI', 'ci': False, 'pyversion': '3.10.4', 'samcliVersion': '1.50.0', 'awsProfileProvided': False, 'debugFlagProvided': True, 'region': '', 'commandName': 'sam local start-api', 'metricSpecificAttributes': {'projectType': 'CFN'}, 'duration': 93, 'exitReason': 'KeyError', 'exitCode': 255}}]}
2022-05-27 13:46:45,646 | HTTPSConnectionPool(host='aws-serverless-tools-telemetry.us-west-2.amazonaws.com', port=443): Read timed out. (read timeout=0.1)
Traceback (most recent call last):
File "/usr/bin/sam", line 33, in <module>
sys.exit(load_entry_point('aws-sam-cli==1.50.0', 'console_scripts', 'sam')())
File "/usr/lib/python3.10/site-packages/click/core.py", line 1130, in __call__
return self.main(*args, **kwargs)
File "/usr/lib/python3.10/site-packages/click/core.py", line 1055, in main
rv = self.invoke(ctx)
File "/usr/lib/python3.10/site-packages/click/core.py", line 1657, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/usr/lib/python3.10/site-packages/click/core.py", line 1657, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/usr/lib/python3.10/site-packages/click/core.py", line 1404, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/usr/lib/python3.10/site-packages/click/core.py", line 760, in invoke
return __callback(*args, **kwargs)
File "/usr/lib/python3.10/site-packages/click/decorators.py", line 84, in new_func
return ctx.invoke(f, obj, *args, **kwargs)
File "/usr/lib/python3.10/site-packages/click/core.py", line 760, in invoke
return __callback(*args, **kwargs)
File "/usr/lib/python3.10/site-packages/samcli/lib/telemetry/metric.py", line 166, in wrapped
raise exception # pylint: disable=raising-bad-type
File "/usr/lib/python3.10/site-packages/samcli/lib/telemetry/metric.py", line 124, in wrapped
return_value = func(*args, **kwargs)
File "/usr/lib/python3.10/site-packages/samcli/lib/utils/version_checker.py", line 41, in wrapped
actual_result = func(*args, **kwargs)
File "/usr/lib/python3.10/site-packages/samcli/cli/main.py", line 87, in wrapper
return func(*args, **kwargs)
File "/usr/lib/python3.10/site-packages/samcli/commands/local/start_api/cli.py", line 94, in cli
do_cli(
File "/usr/lib/python3.10/site-packages/samcli/commands/local/start_api/cli.py", line 193, in do_cli
service.start()
File "/usr/lib/python3.10/site-packages/samcli/commands/local/lib/local_api_service.py", line 79, in start
service.run()
File "/usr/lib/python3.10/site-packages/samcli/local/services/base_local_service.py", line 63, in run
self._app.run(threaded=multi_threaded, host=self.host, port=self.port)
File "/usr/lib/python3.10/site-packages/flask/app.py", line 920, in run
run_simple(t.cast(str, host), port, self, **options)
File "/home/carole/.local/lib/python3.10/site-packages/werkzeug/serving.py", line 1047, in run_simple
fd = int(os.environ["WERKZEUG_SERVER_FD"])
File "/usr/lib/python3.10/os.py", line 679, in __getitem__
raise KeyError(key) from None
KeyError: 'WERKZEUG_SERVER_FD'
Expected result:
The command should not fail.
Additional environment details (Ex: Windows, Mac, Amazon Linux etc)
- OS: Arch Linux/Manjaro
sam --version
: 1.50.0- AWS region: N/A (testing locally)
Issue Analytics
- State:
- Created a year ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Cant start Manjaro - Virtualization
Using Virtualbox, I planned to test Manjaro. However, once I finished installing, the system seemed to freeze on startup.
Read more >Systemd[1]: Failed to start Journal Service - Support
Often, on startup, I encounter an error after selecting to boot Manjaro in the grub menu that states Failed to start Journal Service....
Read more >Unable to use Valgrind - Manjaro Linux Forum
Hi, I have installed valgrind: $sudo pacman -S valgrind And upon installation I tried to use it, but the error message pops up:...
Read more >Kernel failing to boot on startup - Manjaro Linux Forum
I think the reason why it's failing is because I had interrupted manjaro when it was updating. I have looked up similar problems...
Read more >Unable to automatically connect to OVPN on startup - Network
Hi there. I'm trying to achieve the solution described here: https://forum.manjaro.org/t/automatically-connect-to-vpn-on-startup/46298 I ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
That did the trick! Everything is working now, thank you.
thanks @carole-arbogast for quick response. This way of installation is not recommended as customers usually face issues with dependencies versions. Could you please try one of the recommended installation ways mentioned here