hello_world example not working

See original GitHub issue

Description:

I have created the hello_world example from https://github.com/awslabs/aws-sam-cli/blob/develop/docs/getting_started.rst and followed the steps from README.md to build and execute a local server.

But when acessing the server from http://127.0.0.1:3001/hello (also tried http://127.0.0.1:3001) I get the following response:

{"Type": "LocalService", "Message": "PathNotFoundException"}

Steps to reproduce the issue:

  1. Install Miniconda Python 3.6
  2. <miniconda_bin_dir>/pip install aws-sam-cli
  3. <miniconda_bin_dir>/sam init --runtime python3.6
  4. cd sam-app
  5. <miniconda_bin_dir>/pip install -r requirements.txt -t hello_world/build/
  6. cp hello_world/*.py hello_world/build/
  7. <miniconda_bin_dir>/sam --debug local start-lambda

Observed result:

The following response from http://127.0.0.1:3001/hello:

{"Type": "LocalService", "Message": "PathNotFoundException"}

Expected result:

The actual output from app.py

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

Linux Mint 18
Docker version 18.06.0-ce, build 0ffa825
Miniconda Python 3.6.5

Output of sam --version:

SAM CLI, version 0.6.0

Optional Debug logs:

$ sam --debug local start-lambda
2018-08-30 23:19:57 local start_lambda command is called
2018-08-30 23:19:57 2 resources found in the template
2018-08-30 23:19:57 Found Serverless function with name='HelloWorldFunction' and CodeUri='hello_world/build/'
2018-08-30 23:19:57 Trying paths: ['/home/caian/.docker/config.json', '/home/caian/.dockercfg']
2018-08-30 23:19:57 No config file found
2018-08-30 23:19:57 Trying paths: ['/home/caian/.docker/config.json', '/home/caian/.dockercfg']
2018-08-30 23:19:57 No config file found
2018-08-30 23:19:57 http://localhost:None "GET /v1.35/_ping HTTP/1.1" 200 2
2018-08-30 23:19:57 Trying paths: ['/home/caian/.docker/config.json', '/home/caian/.dockercfg']
2018-08-30 23:19:57 No config file found
2018-08-30 23:19:57 Trying paths: ['/home/caian/.docker/config.json', '/home/caian/.dockercfg']
2018-08-30 23:19:57 No config file found
2018-08-30 23:19:57 Starting the Local Lambda Service. You can now invoke your Lambda Functions defined in your template through the endpoint.
2018-08-30 23:19:57 Localhost server is starting up. Multi-threading = True
2018-08-30 23:19:57  * Running on http://127.0.0.1:3001/ (Press CTRL+C to quit)
2018-08-30 23:23:28 127.0.0.1 - - [30/Aug/2018 23:23:28] "GET /hello HTTP/1.1" 404 -
2018-08-30 23:23:33 127.0.0.1 - - [30/Aug/2018 23:23:33] "GET / HTTP/1.1" 404 -

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:1
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

7reactions
jfusscommented, Aug 31, 2018

@Caian You are running the wrong command. The README for sam init states to run sam local start-api.

sam local start-lambda runs a localhost service that mimics the invoke path on the Lambda service locally, so you can invoke the functions locally through AWS CLI or AWS SDKs.

Closing as this is not an issue and the wrong command was run.

1reaction
speciouscommented, Jun 16, 2022

If you run sam local start-lambda you can communicate directly with the locally running lambda service:

aws lambda invoke --endpoint http://localhost:3001 --function-name register out.txt

If you run sam local start-api, it starts a local API gateway and you can make HTTP requests to:

http://127.0.0.1:3001/register

Read more comments on GitHub >

github_iconTop Results From Across the Web

Hello World Example not working · Issue #211 · Gottwik/Enduro
I'm trying to run the hello world example, but am getting the following error when loading the admin interface:.
Read more >
Spring Boot Hello World Example Not working - Stack Overflow
Try cleaning the project from project tab, Add all the maven dependencies to eclipse build path. Then try running it as java application....
Read more >
MuleSoft's Hello World example not working
MuleSoft's Hello World example not working. This is the very most basic example offered by MuleSoft and anyone learning any type of technical...
Read more >
Hello world example not work - Code Composer Studio forum
Looks like CCS is not finding file stdio. h. - Open "Build", "MSP430 Compiler", then click "Include Options". Hope this will work for...
Read more >
helloworld example not working - Google Groups
helloworld example not working. 44 views. Skip to first unread message ... Failed to define class org.jboss.as.quickstarts.helloworld.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found