-
Notifications
You must be signed in to change notification settings - Fork 5.7k
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
Error "Event references not configured authorizer 'name'" when following authorizer tutorial #8781
Comments
Hello @BryanCrotaz, thanks for reporting, before treating it as a bug, could you please upgrade to the latest version of Framework (we're currently on |
I'm using my fork #8043 as .net isn't supported by master, but I'll try to rebase it. |
No, same problem on master. |
My function definition: get-metric-history:
handler: DashboardApi::DashboardApi.HistoryHandlers::GetMetricHistory
environment:
DeviceMetricsTable:
Ref: DeviceMetricsTable
events:
- httpApi:
path: metrics/history
method: get
authorizer: apiAuthorizer
package:
include:
- DashboardApi/DashboardApi.csproj
iamRoleStatements:
- Effect: "Allow"
Action:
- dynamodb:Query
Resource:
Fn::GetAtt:
- DeviceMetricsTable
- Arn
- Effect: Allow # note that these rights are given in the default policy and are required if you want logs out of your lambda(s)
Action:
- logs:CreateLogGroup
- logs:CreateLogStream
- logs:PutLogEvents
Resource:
- 'Fn::Join':
- ':'
-
- 'arn:aws:logs'
- Ref: 'AWS::Region'
- Ref: 'AWS::AccountId'
- 'log-group:/aws/lambda/*:*:*' |
Authorizer: apiAuthorizer:
handler: AuthApi::AuthApi.AuthHandlers::Authorize
package:
include:
- AuthApi/AuthApi.csproj
iamRoleStatements:
- Effect: Allow # note that these rights are given in the default policy and are required if you want logs out of your lambda(s)
Action:
- logs:CreateLogGroup
- logs:CreateLogStream
- logs:PutLogEvents
Resource:
- 'Fn::Join':
- ':'
-
- 'arn:aws:logs'
- Ref: 'AWS::Region'
- Ref: 'AWS::AccountId'
- 'log-group:/aws/lambda/*:*:*'
|
Am I using it incorrectly? |
Worked it out, but error messages were not very helpful. Created a PR with more informative messages. |
Thanks for the update @BryanCrotaz - do you think we could close this issue then? As for supporting different types of authorizers for HTTP API, let's track that discussion here: #8210 |
#8210 seems to have been forgotten about, 5+ months after release of AWS functionality and hardly any activity on this, kinda takes the zero-friction out of the 'zero-friction serverless deployment' |
Hello @ed-sparkes - unfortunatelly, there were some other priorities in the meantime, but we plan to dedicate time to #8210 in the coming weeks. I'll follow up later this week on the original issue about authorizers. Sorry for inconvenience. I'll close this issue and let's move all potential discussions to #8210 |
👋🏻 Hi @pgrzesik ❤️ Would it be possible/would you accept a PR which creates a validation warning when a user uses this syntax? Is there another way this could prevent people from tripping up on Thanks, hope you're well! |
Hello @astuyve 👋 Nice to see you here 🙌 I see how it might be tripping people up as btw, the example you've listed as working I believe is not correct, as the authorizers are defined on |
Hey Piotr! I removed my erroneous example to prevent others from erroneously copying it. Yes, that'd be great! I'd love if the framework would provide an error message stating something like "http authorizer is not valid for httpApi" or something of that ilk. I do not believe this is a defect or flaw in the framework, just a reality of being downstream from AWS, and their offering of two VERY similar (but technically different) API products. |
Thanks for clarification, I'll see how we could incorporate such tip into our current error, thanks @astuyve 🙇 |
Completely failed to work out how to add authorizers to my httpAPI, so trying every example you have.
Followed https://www.serverless.com/framework/docs/providers/aws/events/apigateway#http-endpoints-with-custom-authorizers
I think although this is an http event it's actually a RESTApi?
Get an error
Event references not configured authorizer '<function-name>'
and I can't find any reference to this in the docs. Don't know what event I should be adding to the authorizer function as the examples don't list any events.serverless.yml
sls deploy
outputInstalled version
The text was updated successfully, but these errors were encountered: