BuildNot yet confirmed elsewhere1 publisher2 min readPublished
CDK's OAC setup for Lambda function URLs grants CloudFront one of the two permissions it needs
CDK grants CloudFront only one of the two permissions a locked-down Lambda function URL needs, according to an October 2026 update to a dev.to tutorial. The update also moves new functions to Node.js 24, as nodejs20.x lost security patches on 30 April 2026.
The Engineer · Build desk

What happened
- CloudFront now supports Origin Access Control for Lambda function URLs, and paired with AWS_IAM auth it restricts invocation of the URL to the distribution.
- The tutorial's sample code, below the update note, still pins Runtime.NODEJS_20_X and FunctionUrlAuthType.NONE with response streaming turned on.
- The sample distribution uses the CACHING_DISABLED cache policy so every development request is forwarded to the function.
Why it matters
- decision Teams adopting OAC through CDK have to add the lambda:InvokeFunction grant by hand for now, then remove the duplicate once a CDK release adds it automatically.
- exposure Stacks copied from the original NONE sample leave the function URL without the distribution-only restriction that OAC is meant to enforce.
- cost Every function built from the sample needs a move to Node.js 24 and a retest of its streaming handler, paid by whoever owns those stacks today.
- constraint Because CACHING_DISABLED sends every request to the function, the caching that motivated the setup has to be designed separately before production.
The new pattern changes two settings [3]. The function URL's authType moves from NONE to FunctionUrlAuthType.AWS_IAM, and the CloudFront origin is built with FunctionUrlOrigin.withOriginAccessControl(fnUrl) [3]. With both in place, only the distribution can invoke the URL, according to the tutorial [3]. The author wrote that this is "the production answer to the NONE auth type I warn about in the tips below" [4].
The gap is in the function's resource policy [5]. CloudFront has to be granted both lambda:InvokeFunctionUrl and lambda:InvokeFunction [5]. The author wrote that "at the time of this update the CDK only adds the first" [6]. A stack that relies on the construct alone ships with one of the two grants [14]. The update does not show the code for the second grant or describe what a request returns without it. We would check the synthesized template for both action names before trusting a deployment. We would also keep the extra grant explicit in code, so it is easy to find when a later CDK release adds it automatically.
The runtime change has a date attached [1]. The sample function pins Runtime.NODEJS_20_X [7]. That runtime stopped receiving security patches on 30 April 2026 [1]. The author's advice is scoped to new functions: use Runtime.NODEJS_24_X [2]. The patch cutoff belongs to the runtime, so in our view functions already deployed from the sample need the same move [15]. The handler streams its response through awslambda.streamifyResponse [12]. That streaming path is what we would retest on the new runtime.
The two changes differ in urgency. The runtime cutoff has already passed [1]. The auth change is the author's production recommendation for a feature CloudFront now supports [3][4]. The evidence supports moving runtimes now. It supports leaving NONE as a change to schedule for any stack headed to production, which is how the author frames it [4].
The construct itself is good engineering. When the author's friend first tried this setup, CDK had no FunctionUrlOrigin, and his attempt with HttpOrigin did not work [8]. The author suspected the friend had missed the cache policy [10]. The sample sets CACHING_DISABLED so every request reaches the function during development [10]. The friend's goals were custom domains and customised caching from the origin [9]. A production stack built from this sample still needs a real cache policy in place of CACHING_DISABLED [9][10].
What to watch
- A CDK release in which FunctionUrlOrigin.withOriginAccessControl grants lambda:InvokeFunction itself, making the manual grant redundant.
- Whether the tutorial's sample code is revised from NODEJS_20_X and NONE to match its own October 2026 update note.
Clarity's read
What the record supports and how the coverage leans. The claims behind it follow.
Reality
- Evidence35
- Adoption
- Insufficient
- Hype gap+10
- Incentives
- Insufficient
- Confidence40
Claim ledger
Ranked by verification strength, evidence, and original report placement.
- [1]
The nodejs20.x Lambda runtime stopped receiving security patches on 30 April 2026.
- [2]
The tutorial's update recommends Runtime.NODEJS_24_X for new functions.
- [3]
CloudFront now supports Origin Access Control for Lambda function URLs; FunctionUrlOrigin.withOriginAccessControl(fnUrl) with authType: FunctionUrlAuthType.AWS_IAM lets only the distribution invoke the URL.
- [4]
"the production answer to the NONE auth type I warn about in the tips below"
- [5]
The function's resource policy must grant CloudFront both lambda:InvokeFunctionUrl and lambda:InvokeFunction.
- [6]
"at the time of this update the CDK only adds the first."
- [7]
The tutorial's sample code creates a NodejsFunction with Runtime.NODEJS_20_X and adds a function URL with FunctionUrlAuthType.NONE and InvokeMode.RESPONSE_STREAM.
- [8]
When the author's friend attempted the proof of concept, the CDK had no FunctionUrlOrigin; he tried HttpOrigin instead and could not get it to work.
- [9]
The friend's primary objectives were custom domains and customising caching behaviour from the origin, the function URL.
- [10]
The distribution stack sets cachePolicy to CACHING_DISABLED so requests are always forwarded to the origin during development; the author suspected the friend missed this cachePolicy configuration.
- [12]
The sample handler wraps its function in awslambda.streamifyResponse and pipes data into the response stream.
- [13]
A function URL left on the original sample's NONE auth type does not have the distribution-only invocation restriction that AWS_IAM with Origin Access Control provides.
- [14]
A CDK stack relying only on the construct's automatic grant has one of the two required actions in the function's resource policy.
- [15]
Functions already deployed on nodejs20.x, including any built from the tutorial's sample, run on a runtime that has had no security patches since 30 April 2026.
Sources
1 independent publisher whose own reporting we read for this story.
- dev.toUsing a Lambda Function URL with AWS CloudFront via AWS CDK
1 article · October 10, 2026
Topics and entities
Follow any of these and your For You feed starts watching them — no settings page required.
Topics
- Infrastructure as CodeFollow
- Serverless computingFollow
- Cloud access controlFollow
Entities
- AWS Cloud Development KitFollow
- AWS LambdaFollow
- Amazon CloudFrontFollow
- CloudFront Origin Access ControlFollow
- Node.jsFollow
- Amazon Web ServicesFollow
- dev.toFollow