-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
sam local start-api Missing Authentication Token for root path '/' #437
Comments
Starting from scratch for debug:
Attempting to access http://127.0.0.1:3000/ I see Changing the
Now when I access http://127.0.0.1:3000/anythinghere it continues to work as expected.. so I don't think that is my issue. Edit: Digging a little deeper.. it looks like even if I explicitly set the path to Edit2: Additional context, using https://github.com/gorilla/mux + https://github.com/awslabs/aws-lambda-go-api-proxy internally. When I set the path to |
I'm getting the same error with SAM CLI, version 0.4.0. It doesn't look like it's routing to the static files in my case.
|
Shouldn't localhost:3000 -> serves the index.html? |
So this is an issue with Flask and how the endpoints are modeled. By default Flask does not resolve the
Maybe? But SAM CLI can't since we support API to Lambda on the same root path, so there can be path conflicts. Instead, you should just add the Marking this as a bug |
I am getting this issue only on GET calls. POST works fine. |
@amcp I'm seeing the opposite; Windows 10, SAM CLI version 0.7.0. |
I'm experiencing the same. Using SAM local eg: using
whereas using
Both configurations appear to work normally once deployed to the cloud. I think this is going to become more prevalent as an issue now the runtime API has opened new languages and frameworks up to Lambda, and more people are going to get on-board with developing serverless functions locally, expecting their chosen language / framework to handle routing for them. MacOS, SAM CLI version 0.8.1 |
@nealio82 While the results are the same, your issue is different than the original issue. I commented above on what this issue relates to. Please open a separate issues so we can track and investigate separately. |
@jfuss Ok, shall do :) Although I'm not sure that it is different? Looking at the original bug report by @0xdevalias it looks like the config is almost exactly the same as the config I have, and their experience is the same... (the only difference I can see is that I also have |
@nealio82 You didn't state anything about a root path ( |
Ah, sorry, I didn't think it was relevant - I was adding context to the fact I'm seeing the same as the OP, and I didn't want to simply add an unhelpful '+1' or 'me too' comment. The root path works OK, as implied by 'GET returns the "missing authentication token" on all catch-all routes'. |
I had opened #1037 and closed it because I think this is the root issue. Thanks! |
So I think I might have found a way to fix this – commenting out the static files config passed to flask here allows Happy to put together a PR, but not sure what you want to do... while serving static files is useful it's not something that APIG does and users can achieve something similar with a lambda serving files at a specific route. If you want to avoid a breaking change, seems like path of least change is to only pass this config to flask if the user specifies the |
Erm, scratch that. Was switching between samdev and sam and it seems my issue sorted it self out and now |
Not for me. |
CONFIRMED! Setting |
it's amusing because this breaks your front page hello world example as generated by your kit |
it's actually pretty concerning that nine months after you found out your baseline generated code doesn't serve root correctly, it's still an outstanding bug that's a one-liner route fix in flask |
Well in fairness, they have done ALOT of work and if I had to pick, I'd say I appreciate the effort being able to run Ruby on Lambda and other things vs something I can hack locally that is not an issue when deployed. That said, would be nice to see fixed. |
I followed https://github.com/stackery/php-lambda-layer to also get this "Missing Authentication Token". I've read this and I'm non-the-wiser. Is there an error with https://media.dev.unee-t.com/2019-04-04/template.yaml ? SAM CLI, version 0.14.2 Must say the SAM cli is a bit rough around the edges. Why can't it print the endpoint in the CLI? zomg. https://s.natalian.org/2019-04-04/1554348366_2560x1440.png |
Hi, are there any updates on this one? I have exactly the same issue. |
THIS IS A MACOS VERSION OF #1316 begin: template.yaml
end template.yaml hit localhost:3000/pedigreeskitselas:PPRConsole$ sam local start-api Fetching lambci/lambda:python3.7 Docker container image...... During handling of the above exception, another exception occurred: Traceback (most recent call last): I cannot locate the mounts under ~/Library/Containers |
As @metaskills commented:
This did not work for me. :( My version is: $ sam --version
$ SAM CLI, version 0.19.0 |
By adding a root endpoint and another separate proxy endpoint to the SAM template I was able to get it to work:
It seems like this convention of configuring multiple events for the same handler is done this way in other frameworks such as Zappa and Serverless (see the serverless.yml from this link). |
I am using CDK to create the apigateway and adding ResourceBase.addProxy and setting the anyMethod to true worked for me and I dont get the Missing Authentication... |
I have a potential fix at #6376 if the maintainers are interested... happy to implement myself. |
Description:
When I run
sam local start-api -s public/
and try to access my endpoint, I receive aMissing Authentication Token
in the browser. This same code runs fine when deployed to lambda, and correctly exposes my endpoint without auth required.Observed result:
Missing Authentication Token
Expected result:
My API is exposed without auth.
Additional environment details (Ex: Windows, Mac, Amazon Linux etc)
macOS
Output of
sam --version
:SAM CLI, version 0.3.0
The text was updated successfully, but these errors were encountered: