-
Notifications
You must be signed in to change notification settings - Fork 3.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
(lambda): Return domain name for Lambda Function Url #20254
Comments
The function url is an attribute returned by cloudformation according to their documentation. I'm not sure that this is achievable on our end as we are bound to cloudformation. We'd have to parse the url as a Lazy string just as you've done, and I'm not sure that's feasible to maintain at the moment. |
I encountered the same problem and figured out a similar "trick" to make it work... I ended up using : origin: new HttpOrigin(Fn.select(2, Fn.split('/', lambdaUrl.url))) Do you still believe it shouldn't be a feature ? @kaizencc |
@Misfits09 I was able to move forward with your trick, but now I'm stuck with a forbidden when calling the function, how can I grant permissions to make the invocation? |
@Dav3rs You've probably figured this out, but the 403 is likely being caused by the AUTH_TYPE for the URL being defaulted to AWS_IAM, meaning its looking for an AWS Signature in the request. You can either open up the URL by setting the authentication to none, or you can implement a CloudFront request signer to sign outgoing requests with a role the has been granted the ability to invoke your lambda url. |
As this ticket has been resolved, it would be appropriate to close it. |
|
Describe the feature
I've tried to connect my Lambda with a function url endpoint to a CloudFront origin, but the function url only returns the url itself but not the domain name, which is required for an http origin.
Because the url is a token only resolved at synth time, it cannot be modified easily (to return only the domain name).
I had to use a workaround: https://github.com/MarkusWendorf/cdk-function-url
Gist:
That's why I would propose that the FunctionUrl resource also returns the domain name.
Use Case
I've tried to connect my Lambda with a function url endpoint to a CloudFront origin, but the function url only returns the url itself but not the domain name, which is required for a http origin.
Proposed Solution
Return the domainName in addition to the url from the FunctionUrl resource.
Other Information
No response
Acknowledgements
CDK version used
2.21.1
Environment details (OS name and version, etc.)
Macos 12.3.1
The text was updated successfully, but these errors were encountered: