CloudFront Functions Network Calls - One Call per Invocation, Origin IDs Only, and a One-Second Limit
First Published:
Last Updated:
cf.fetch() sends requests to origins and reads responses, while cf.beacon() sends requests without waiting for a response. It looks as if authorization checks, A/B testing, and sending metrics can now be done within CloudFront Functions, rather than in Lambda@Edge or at the origin.However, calls are limited to origins already configured on the same distribution. Each invocation can only initiate one call, and all calls are terminated after one second. Settings inherited from the origin, including Origin Access Control (OAC) signatures, VPC origins, connection reuse, custom origin headers, and origin mTLS, apply to these calls. Conversely, the developer guide states that the response timeout is the only origin setting that is not inherited by the calls. Furthermore, as a separate matter from origin settings, call responses are not cached, and AWS WAF does not inspect these calls.
This article breaks down information regarding CloudFront Functions network calls, based on AWS documentation, covering destinations and call counts, settings inherited from the origin, the response timeout that is not inherited, what falls away outside the origin settings, the one-second time limit and handling of failures, and unsupported configurations. This article is based on documentation reviewed on December 1, 2026 (during re:Invent 2026). No practical testing has been performed. This article does not cover pricing, Lambda@Edge implementation, KeyValueStore design, or the steps for configuring origins.
Related articles on this site:
- CloudFront KeyValueStore and Edge Functions Cookbook: A/B Testing, Geo Routing, Feature Flags, and Token Validation
- Amazon CloudFront Origin Architecture Guide - Origin Access Control, Origin Shield, Failover, and VPC Origins
- AWS History and Timeline regarding Amazon CloudFront - Overview, Functions, Features, Summary of Updates, and Introduction
Table of Contents
- 1. Scope and Assumptions
- 2. Destinations and Call Count
- 3. Origin Settings That Are Inherited and the Response Timeout That Is Not
- 4. What Falls Away Outside the Origin Settings
- 5. The One-Second Limit and Handling Failures
- 6. Unsupported Configurations and the Lambda@Edge Comparison Table
- 7. Frequently Asked Questions about Network Calls in CloudFront Functions
- 8. Summary
- 9. References
1. Scope and Assumptions
This chapter first defines the intended audience, the scope of this article, the referenced materials, the notation used, and the usage of terminology. The following eight points represent the key conclusions:- The destinations of these calls are limited to origins already configured on the same distribution. These origins are referenced by their ID, and URLs containing hostnames cannot be used (see Section 2.1).
- Within a single invocation, only one call can be made, counting
cf.fetch()andcf.beacon()together. A second call will result in an exception. Even if you pass twocf.fetch()calls toPromise.all(), an exception will occur. KeyValueStore can be read any number of times within a single invocation (see Sections 2.4 and 2.5). - The developer guide lists five features that developers do not need to reimplement in function code for the calls: OAC signatures, VPC origins, connection reuse, custom origin headers, and origin mTLS. The What's New post gives three of these as examples (see Sections 3.1 and 3.2).
- OAC signatures adhere to the origin's signing behavior. For origins configured with
no-override, if the function adds anAuthorizationheader, CloudFront will not sign the call (see Section 3.3). - The developer guide describes the response timeout as the only origin setting that is not inherited. Even if the origin has a long response timeout configured, the call will still be terminated after one second (see Section 3.4).
- Outside the origin settings, some things do not apply to the call. Viewer headers, cookies, and query strings are not copied to the call (except for three proxy headers). The call's response is not cached, and AWS WAF does not inspect the call (see Chapter 4).
- The one-second limit applies to the entire call, including connection establishment and body reading. If the function does not catch any exceptions, CloudFront will return an HTTP 503 error to the viewer.
cf.beacon()operates on a best-effort basis, and any delivery failures can only be observed throughlogDeliveryErrors(see Chapter 5). - Network calls are not available on distributions on the free pricing plan, multi-tenant distributions, distributions using continuous deployment, or Connection Functions. They are also not available in the test API and console tests (see Chapter 6).
1.1 Intended Audience
This article is for developers who want to use CloudFront Functions to perform authorization checks, A/B testing, and data collection. It is also for developers who previously handled these processes using Lambda@Edge or in their origins, and for readers who are starting to assume that, because functions can now make calls, CloudFront Functions can do the same things as Lambda@Edge.1.2 What This Article Covers and Does Not Cover
This article coverscf.fetch() and cf.beacon(), destinations and call counts, origin settings that are inherited, the response timeout that is not inherited, request construction, caching and AWS WAF, quotas, exceptions and HTTP 503 errors, testing, unsupported configurations, and where KeyValueStore and Lambda@Edge fit.The following topics are out of scope, with the articles that cover them:
- KeyValueStore design and patterns for choosing between edge functions: CloudFront KeyValueStore and Edge Functions Cookbook
- OAC, VPC origins, and detailed configuration procedures for origins: Amazon CloudFront Origin Architecture Guide
- Dates of CloudFront features: AWS History and Timeline regarding Amazon CloudFront
This article does not cover pricing, Lambda@Edge implementation, or performance comparisons.
1.3 Verification Date and Reviewed Materials
The verification date is December 1, 2026. This date falls during the re:Invent 2026 conference (November 30 to December 4, 2026), and the pages reviewed may change during the conference period. As of December 1, 2026, there were no announcements in CloudFront's What's New regarding changes to network calls that were posted after November 18, 2026. The following three resources were reviewed:- Amazon CloudFront Developer Guide: Pages including "Helper methods for network calls" (referred to as "the main page"), "Quotas" (specifically the table on "Quotas on CloudFront Functions network calls"), "JavaScript runtime 2.0 features," "Use async and await," "Restrictions on CloudFront Functions," and "Differences between CloudFront Functions and Lambda@Edge."
- What's New: "Amazon CloudFront Functions now supports network calls" (posted November 18, 2026, 16:00 UTC).
- AWS Networking & Content Delivery Blog: "Introducing network calls in Amazon CloudFront Functions" (November 18, 2026).
1.4 Notations
This article uses the following three notations for each statement:| Notation | Meaning |
|---|---|
| Stated | Found in AWS documentation. |
| Not stated | Not found in the documents reviewed for this article. This does not constitute proof of non-existence. |
| Inference | Derived from the information presented in the documents. |
Nothing in this article was tested on a live system. All statements within this article are either based on information found in the documents or are inferences drawn from that information.
1.5 Usage of Terms
This article uses the following terms with specific meanings:| Term Used in this Article | Refers to |
|---|---|
| Network Call | A request to the origin made by cf.fetch() or cf.beacon() within a function. |
| Viewer Request | A request received by CloudFront from the viewer that triggers the function. |
| Origin Settings | Settings configured for each origin within a distribution. This includes OAC, VPC origins, custom origin headers, origin mTLS, and response timeouts. |
| Inherited | An origin setting also applies to network calls. |
| Not Inherited | An origin setting does not apply to network calls. On the main page, this is only the response timeout. |
| Not Applied, Not Copied | Things that are not origin settings (caching, AWS WAF inspection, and viewer headers) do not work on network calls. |
This article separates "not inherited" from "not applied, not copied" because the main page limits the origin settings that do not carry over to one, the response timeout. Caching, AWS WAF, and viewer headers are covered in other sections of the same page (Limitations and How CloudFront builds the request).
1.6 What Changed on November 18, 2026
What's New describes the situation before the change as follows:Previously, if your logic depended on data from another service, you had to use Lambda@Edge or move that logic to your origin.
The main page states that network calls can be made in viewer request and viewer response functions (Stated). The function is created with JavaScript runtime 2.0, and the first line of the code must contain the following statement (Stated).
import cf from "cloudfront";
cf.fetch() and cf.beacon() can only be called within handlers. They will not function from the global scope (Stated). What's New also states that network calls are now available across all CloudFront edge locations (Stated).2. Destinations and Call Count
This chapter describes where network calls can be sent and how many can be sent.2.1 The Destination Is an Origin on the Same Distribution
The main page describes the destination as follows:The destination of the network call must be an origin that is already configured on the same distribution. You can't pass a URL with a host name.
The function passes a path and the origin ID (Stated). The origin ID is the same value displayed as the "Name" field in the CloudFront console, and as the
Id in the CloudFront API and AWS CloudFormation (Stated). The originId in cf.fetch() and cf.beacon() must precisely match the ID of an origin on the same distribution (Stated).Therefore, to call an external API, you must add that API as an origin on the distribution (Inference). The AWS blog provides an example of detecting third-party bots and fraudulent activity, demonstrating a configuration that adds a detection API as an origin on the distribution (Stated). For the origin that a function calls, the same blog also recommends not creating a cache behavior that routes traffic to that origin unless needed (Stated).
2.2 Path and Origin Path
path is a required element, consisting of the URI path and, optionally, a query string (Stated). The path must begin with / (Stated). CloudFront sends requests by appending the path to the domain name of the origin specified by options.originId. If an origin path is configured, the path is appended after the origin path (Stated).For example, if you send
cf.fetch('/v1/authorize', ...) to an origin with an origin path of /prod, the request path will be /prod/v1/authorize (Inference).2.3 Method and Headers Format
Themethod must be one of the following: GET, HEAD, POST, PUT, PATCH, DELETE, or OPTIONS. If omitted, it defaults to GET (Stated). The value must be in uppercase. The main page states that, unlike the standard fetch(), the method is not normalized, so a value such as 'post' throws a TypeError (Stated).Option names are case-sensitive, and unknown options are ignored (Stated). In the main page's example,
Method: 'POST' is ignored, and the request is sent using GET. If the same call also includes a body, a TypeError will occur because a body cannot be included with a GET request (Stated).The
headers should be a plain object where the property names correspond to header names and the values are strings (Stated). This format differs from the format of event.request.headers (the shape with { value: ... }). Attempting to directly copy the event's format into the options will result in an exception (Stated).2.4 One Call
The main page describes the call count as follows:A function can make one network call per invocation. Both fetch() and beacon() count toward this one network call. A second network call throws an error.
The section regarding
cf.beacon() describes the same concept as follows:Each invocation can make one network call in total, using either fetch() or beacon(), not one of each.
It is not possible to combine verifying authorization with
cf.fetch() and then sending metrics with cf.beacon() in the same invocation (Inference, based on the previous two statements).Promise combinators will not increase the allowable call count either. The main page states that if you pass two
cf.fetch() calls to Promise.all(), an exception will occur (Stated). The Use async and await page also states that multiple network calls cannot be made using promise combinators (Stated). The same page further explains that promise combinators, such as Promise.all, and promise chain methods, such as then, can require high function memory usage, and recommends using the await syntax (Stated).The Quotas page states that the number of network calls per invocation (the sum of
cf.fetch() and cf.beacon()) is limited to one, and that this value cannot be adjusted (Stated).2.5 Network Calls and KeyValueStore
The main page includes a section detailing when to use network calls versus CloudFront KeyValueStore as methods for reading data within functions. Table 1 arranges what that section says.Table 1: Choosing Between Network Calls and KeyValueStore (Content of the Main Page)
| Aspect | Network Calls | KeyValueStore |
|---|---|---|
| Suitable Data | Data that changes with each request and requires the most up-to-date information (e.g., whether a token has been revoked, which segment a viewer belongs to). | Static data or data that changes infrequently (e.g., redirect tables, reference tables, daily feature flags). |
| Data Size | Large datasets that cannot fit within a key-value store (e.g., an entire user table, a product catalog). | Data that fits in the total size limit of the key-value store. |
| Number of Reads per Invocation | Once | Any number of times. |
| Read Method | Request to the origin | Read at the edge, without external calls. |
The main page also provides examples of using both methods. One example involves reading an experiment configuration from KeyValueStore to determine which test is active, and then using a network call to assign the viewer a variant (Stated). If a single request requires multiple values, those values go in KeyValueStore (Inference, from the "Number of Reads per Invocation" row in Table 1).
The usage of KeyValueStore is further discussed in CloudFront KeyValueStore and Edge Functions Cookbook.
3. Origin Settings That Are Inherited and the Response Timeout That Is Not
This chapter outlines the origin settings that apply to network calls and those that do not, referencing both the main page and the What's New post.3.1 The Five Items the Developer Guide Lists
Because a call goes through an origin, the main page lists the following five items as things you do not have to reimplement in function code (Stated).| Item Listed by the Main Page | Key Points of the Main Page's Explanation |
|---|---|
| Origin Access Control (OAC) | Sign requests using SigV4. You can access private Amazon S3 buckets, Lambda function URLs, and other AWS origins without including credentials in your function's code. |
| VPC Origins | Access services within private subnets. Public endpoints are not required for the destination. |
| Connection Reuse | CloudFront typically maintains warm connections to the origin, allowing requests to bypass TCP and TLS establishment. |
| Custom Origin Headers | Custom headers configured for the origin are also sent with the request. Shared secrets and routing headers can be placed in the distribution's configuration rather than in the function's code. |
| Origin mTLS | Mutual TLS configured for the origin is also applied to the request. CloudFront presents the origin's client certificate, so the function does not need to handle certificates or private keys. |
In addition, the
path description states that the origin path described in Section 2.2 also applies to calls (Stated). This article does not count origin path as a sixth item in the main page's list. The main page lists only the five items above.3.2 The Three Examples in What's New
What's New describes what carries over as follows:Both methods take advantage of the origin settings already on your distribution, including origin access control (OAC), VPC origins, and connection reuse.
The three items in What's New follow the word including, so they are examples. Custom origin headers and origin mTLS appear only in the list on the main page of the developer guide (Stated). Reading only What's New, it can look as if only three settings carry over, but the complete list is the five items on the main page (Inference, from comparing the lists in the two documents).
3.3 OAC Signing Follows the Signing Behavior
The section "How CloudFront builds the request" on the main page describes OAC signatures as follows:Signing follows the signing behavior of the origin.
According to the same section, if the signing behavior is set to
never, CloudFront will not sign the call. If it is set to no-override, CloudFront will not sign the call if the function adds an Authorization header, or if the origin has a custom Authorization header (Stated).Therefore, if a function calls an origin that is protected by OAC with
no-override and puts the viewer's token in the Authorization header, that call reaches the origin without being signed with SigV4 (Inference, based on the above conditions). The AWS blog's authorization example puts authorization in the headers of cf.fetch(). The blog does not state whether the origin in that example uses OAC (Not stated). When sending tokens, it is necessary to coordinate the origin's signing behavior with the name of the header used to include the token (Inference).The overriding of the
host header is also subject to conditions based on the origin settings. According to the main page, when making calls to custom origins that do not use OAC, it is possible to set the host header (Stated). However, when using Amazon S3 origins or origins that have OAC enabled, setting the host header will result in a TypeError (Stated).For requests with a body, there is also a specific handling of the
x-amz-content-sha256 header. CloudFront automatically adds this header. For requests with a body, it sets the value to UNSIGNED-PAYLOAD; for requests without a body, it sets the value to an empty string hash (Stated). An exception to this occurs when sending a POST or PUT request with a body to a Lambda function URL. Because the function URL does not accept unsigned bodies, the function must include the SHA-256 digest of the body in the x-amz-content-sha256 header (Stated).The configuration of OAC signing behavior is discussed in Amazon CloudFront Origin Architecture Guide.
3.4 The Response Timeout That Is Not Inherited
Following the list of five items on the main page, the following sentence is placed:The response timeout is the one origin setting that does not carry over. A network call times out after 1 second even when the origin is configured with a longer response timeout.
The only origin setting that this sentence says does not carry over is the response timeout (Stated). Even if the response timeout for the origin is extended, the wait time for network calls will not increase (Stated). A difference arises: viewer requests wait until the origin's response timeout is reached, while function calls are terminated after one second (Inference, based on the preceding sentence).
Figure 1 illustrates what origin settings apply to both viewer requests and network calls when both utilize the same origin, and what falls away on the call side.

3.5 Origin Settings the Main Page Does Not Describe
Whether the following origin and distribution settings apply to network calls is not stated on the main page (Not stated).- Origin Shield
- Origin Group (Failover)
- Keep-alive timeout
- Connection attempts and connection timeout
- HTTP version for the origin (a What's New post on November 23, 2026 announced HTTP/2 to origins)
This article does not state whether these settings are inherited or not. The main page's sentence with "the one origin setting that does not carry over" names the response timeout, and the page does not describe how each of the above settings works on the call path (Not stated). In particular, for origin groups, the documents reviewed for this article do not state whether an origin group's ID can be passed as
originId (Not stated).4. What Falls Away Outside the Origin Settings
This chapter describes things that are not origin settings but still do not apply to network calls. On the main page, the sections "How CloudFront builds the request" and "Limitations" address these topics. They are separate from the origin setting that is not inherited (the response timeout), which Chapter 3 covered.4.1 Requests Are Built from Scratch
The main page describes how requests are assembled as follows:CloudFront constructs each network call from scratch. Except for the proxy headers listed below, it does not copy the viewer's headers, cookies, or query string onto the request.
If the origin requires something from the viewer's request, the function must explicitly include it in either the
headers or body (Stated). Unless the function includes them, viewer-provided Authorization headers or cookies will not be included in the request (Inference, based on the previous sentence).There are three exceptions to this: the
X-Forwarded-For, Via, and CDN-Loop headers. CloudFront copies these from the viewer's request and ignores any values the function supplies for them (Stated).Furthermore, there are headers that, when included in the request, will result in a
TypeError. The main page lists four such headers, in addition to the existing Disallowed headers for CloudFront Functions: Accept-Encoding, Content-Length, TE, and Transfer-Encoding (Stated).The limitation that the function cannot read the body of the viewer's request remains unchanged. The "Restrictions on CloudFront Functions" page states that the function cannot access the body of the viewer's HTTP request, and that this is distinct from the body that the function assembles and sends in a network call (Stated).
4.2 Responses Are Not Cached
The Limitations section states the following:CloudFront doesn't cache network call responses. Every invocation that reaches a network call makes one.
Even if a viewer request is served from the cache, the viewer request function runs every time, and each invocation that reaches the call sends a request to the origin (Inference, from the sentence above and from the viewer request function running before the cache lookup). The AWS blog states that because the function executes before the cache is checked,
cf.beacon() also counts cached page views (Stated). This behavior also means that the number of network calls grows in proportion to the number of viewer requests (Inference). The origin's processing capacity needs to be estimated from this number (Inference).4.3 AWS WAF Does Not Inspect Calls
The Limitations section states the following:AWS WAF does not inspect network calls. The web ACL associated with your distribution evaluates viewer requests, not requests your function makes.
The web ACL associated with a distribution evaluates viewer requests (Stated). Values that the function places in a call reach the origin without undergoing AWS WAF evaluation (Inference, based on the previous sentence). The origin receiving the call still needs to validate the input, just as it would when receiving a viewer request (Inference).
4.4 Calls Are Identified as Separate Requests
The response to a network call includes its ownx-amz-cf-id and is distinct from the x-amz-cf-id of the viewer request that invoked the function (Stated). The main page states that these are two separate requests, each with its own identifier. When examining a call, use the identifier from the call's response, which can be retrieved using response.headers.get('x-amz-cf-id') (Stated).4.5 What Is Inherited, What Is Not, and What Does Not Apply
Table 2 combines Chapters 3 and 4.Table 2: What Applies to Network Calls and What Does Not
| Category | Item | Handling in Calls | Section on the Main Page |
|---|---|---|---|
| Inherited Origin Settings | OAC | Signed with SigV4. Follows signing behavior. | Initial listing, How CloudFront builds the request |
| Inherited Origin Settings | VPC origins | Allows access to services on private subnets. | Initial listing |
| Inherited Origin Settings | Connection Reuse | Can skip TCP and TLS establishment using warmed connections. | Initial listing |
| Inherited Origin Settings | Custom Origin Headers | Included in the call. | Initial listing |
| Inherited Origin Settings | Origin mTLS | CloudFront presents the client certificate. | Initial listing |
| Inherited Origin Settings | Origin Path | The path follows the origin path. | fetch() and beacon() path |
| Not Inherited Origin Setting | Response Timeout | Calls are terminated after 1 second. | Immediately after initial listing |
| Not an Origin Setting | Cache | Call responses are not cached. | Limitations |
| Not an Origin Setting | AWS WAF | Calls are not inspected. | Limitations |
| Not an Origin Setting | Viewer Headers, Cookies, Query String | Not copied (except for X-Forwarded-For, Via, and CDN-Loop). | How CloudFront builds the request |
| Not Described on the Main Page | Origin Shield, Origin Groups, Keep-Alive, Connection Attempts, HTTP Version | Not specified as either inherited or not inherited. | None |
5. The One-Second Limit and Handling Failures
This chapter outlines network call quotas, where the one-second limit applies, the types of exceptions that may occur, and the consequences when these exceptions are not handled.5.1 Quotas
Table 3 is the "Quotas on CloudFront Functions network calls" table on the Quotas page. The page states that these quotas are not adjustable (Stated).Table 3: CloudFront Functions Network Call Quotas (as of December 1, 2026)
| Item | Default Quota |
|---|---|
Number of network calls per invocation (total of cf.fetch() and cf.beacon()) | 1 |
| Network call timeout (from request submission to receipt of the last byte) | 1 second |
| Maximum size of the request body | 10 KB |
| Maximum size of the response body | 10 KB |
| Maximum length of request header names | 256 bytes |
| Maximum length of request header values | 1,783 bytes |
| Maximum total size of all headers (request or response) | 10 KB |
| Maximum length of the path and query string for network calls | 8 KB |
According to the main page, a
TypeError will occur if the request or response is too large, or if the origin's response headers are too large for CloudFront (Stated).5.2 The One Second Covers the Whole Call
The main page describes aTimeoutError as follows:The origin did not return a complete response within 1 second. The limit applies to the whole call, including connection setup and reading the body.
The quota table defines one second as the time from request transmission to the reception of the final byte (Stated). The main page describes this as encompassing the entire call process, including connection setup and reading the body (Stated). While the two pages describe this timeframe differently, the main page explicitly includes connection establishment. This article reads this as: everything from connection setup to the last byte of the body must finish within one second (Inference, based on the text on the main page).
Connection establishment can be bypassed if connection reuse is utilized. The main page states that CloudFront usually already holds a warm connection to the origin (Stated). The page says usually, not always. When no warm connection is available, TCP and TLS setup falls inside the one second (Inference).
The main page includes the following note regarding distant origins:
A TLS failure to a distant origin, or an origin on a private IP address, can surface as a TimeoutError rather than an origin error, because the 1 second limit is reached first. To call a service in a private network, use VPC origins.
Figure 2 illustrates the timeframe subject to the one-second limit, as well as the outcomes when an exception is caught and when it is not. The breakdown of time allocated to each step is not described on the main page, so it is not depicted (Not stated).

5.3 Types of Exceptions
The main page sorts the exceptions thatcf.fetch() can throw into the following four (Stated).| Exception | Causes Listed by the Main Page |
|---|---|
TypeError | The call is invalid or does not reach the origin. This includes invalid arguments, disallowed headers, requests or responses that are too large, unknown origin IDs, and distributions that do not support network calls. This also includes DNS failures, connection failures, TLS failures, headers in the origin's response that are too large for CloudFront, and cases where the origin closes the connection. |
TimeoutError | The origin did not return a complete response within one second. |
InternalError | A call failed within CloudFront. |
SyntaxError | response.json() throws this error when it encounters a body that is not valid JSON. |
The message for
TypeError names the reason. An example from the main page is The request could not be completed due to OriginDnsError (Stated). Origins that resolve to loopback addresses or reserved IP addresses are also refused with the same OriginDnsError (Stated).Invalid arguments reject the Promise returned by
cf.fetch() (Stated). This allows you to handle both argument errors and errors in the call itself with a single await inside try and catch (Stated).5.4 Uncaught Exceptions Result in HTTP 503 for the Viewer
The main page says to wrap everyawait cf.fetch() in try and catch and to decide whether to pass the request through (fail open) or stop it (fail closed) when the call fails (Stated). If an exception is not caught, the function will fail, and CloudFront will return an HTTP 503 error to the viewer. This is consistent with how other unhandled function errors are treated (Stated).The following code provides a framework for stopping requests (fail closed) in the event of an authorization check failure. It assumes a JavaScript runtime 2.0 viewer request function associated with a distribution that has an origin with the ID
auth-origin. The origin ID and path are examples, and this article has not run this code on a live system.import cf from 'cloudfront';
async function handler(event) {
const request = event.request;
try {
const response = await cf.fetch('/v1/check', {
originId: 'auth-origin',
method: 'POST',
headers: { 'content-type': 'application/json' },
body: JSON.stringify({ uri: request.uri }),
includeBody: true,
});
if (!response.ok) {
return { statusCode: 403, statusDescription: 'Forbidden' };
}
const result = await response.json();
if (!result.allowed) {
return { statusCode: 403, statusDescription: 'Forbidden' };
}
return request;
} catch (e) {
// Fail closed. Without this catch, CloudFront returns HTTP 503 to the viewer.
console.log('Network call failed: ' + e.name);
return { statusCode: 503, statusDescription: 'Service Unavailable' };
}
}
This code does not include the viewer's headers in the request. As described in Section 4.1, if the origin requires viewer-specific values, the function should include them in either the
headers or body.5.5 Reading the Response Body
Thecf.fetch() function's includeBody parameter determines whether CloudFront reads the response body and passes it to the function. If omitted, it defaults to false (Stated). Without includeBody: true, any methods attempting to read the body will return empty values: text() returns "", json() returns null, and bytes() and arrayBuffer() return empty values (Stated).The response body can only be read once. Attempting to read it again after using
text(), json(), bytes(), or arrayBuffer() is rejected with TypeError: body already read (Stated). The Limitations section notes that CloudFront Functions do not support streaming of the response body (Stated).Because
includeBody defaults to false, functions that rely on the response body to make decisions get null from json() if they forget to specify includeBody: true (Inference, based on the above).5.6 cf.beacon() Is Best Effort
cf.beacon() sends a request to the origin without waiting for a response and immediately returns undefined (Stated). The main page describes the behavior of a beacon as follows:A beacon is best effort. Don't use it for anything that must succeed.
If there is an error in the arguments, an exception is immediately thrown and can be caught using
try and catch. If a failure occurs after the function has moved on, the function itself will not be notified of that failure (Stated). The only way to observe such failures is to set logDeliveryErrors to true. The default value is false. When set to true, undelivered beacons will be logged to the same log group as the function's console.log() (Stated). If the origin returns a 2xx or 3xx status code, the beacon is considered successfully delivered (Stated).cf.beacon() does not accept the includeBody parameter; passing it will result in a TypeError (Stated). This is because there is no response to read. cf.beacon() also counts toward the one network call per invocation (Stated).5.7 Calls Throw TypeError in Tests
According to the main page, the TestFunction API and the Test tab in the CloudFront console do not support network calls (Stated). Within tests, cf.fetch() and cf.beacon() will throw a TypeError ("cloudfront.fetch" is not available in test invocations), and the test will fail unless the function catches this error (Stated). The main page recommends wrapping these calls within try and catch blocks to allow testing of other parts of the function (Stated).Therefore, the success path of these calls (the portion that reads and evaluates the origin's response) is not exercised in the test API or the console's tests (Inference, based on the above description).
5.8 Relationship to Compute Utilization
The Restrictions on CloudFront Functions page states that the limit on how long a function can run is measured as compute utilization (Stated). Whether network call wait times are counted towards compute utilization is not stated in the documents reviewed for this article (Not stated).6. Unsupported Configurations and the Lambda@Edge Comparison Table
This chapter describes the configurations where network calls are not available and what the Lambda@Edge comparison table says.6.1 The Ten Items in Limitations
As of December 1, 2026, the Limitations section of the main page lists the following ten items (Stated; the count is this article's own).- Distributions on the free pricing plan do not support network calls.
cf.fetch()andcf.beacon()will throw aTypeError(for example,"cloudfront.fetch" is not available on the free pricing plan). - Multi-tenant distributions and distribution tenants do not support network calls.
cf.fetch()andcf.beacon()must only be called within a handler. They will not function from the global scope.- Only one network call is permitted per invocation.
- The
TestFunctionAPI and the Test tab in the console do not support network calls. - CloudFront Functions do not support streaming the response body.
- AWS WAF does not inspect network calls.
- CloudFront does not cache responses from network calls.
- Connection Functions do not support network calls.
- Distributions using continuous deployment do not support network calls.
Regarding item 1, the free pricing plan is the Free tier of CloudFront's flat-rate pricing plans (Stated, CloudFront flat-rate pricing plans page). This article does not discuss pricing. Items 2 and 10 indicate that even if functions can be created, the configuration of the associated distribution may prevent calls from being used (Inference). The main page also lists distributions that do not support network calls as a cause of
TypeError (Stated).Item 9, Connection Functions, are functions that run during mTLS connection establishment and are used to validate client certificates (Stated, Customize with CloudFront Connection Functions page). The main page names Connection Functions and states that they do not support network calls (Stated). This article's descriptions of network calls specifically pertain to viewer request and viewer response functions.
6.2 The Lambda@Edge Comparison Table
The page detailing the differences between CloudFront Functions and Lambda@Edge states the following for the "Network access" row of the comparison table as of December 1, 2026 (Stated):| CloudFront Functions | Lambda@Edge | |
|---|---|---|
| Network access | Yes, one call per invocation to an origin configured on the same distribution | Yes, any destination |
Among the use cases Lambda@Edge suits, the same page lists functions that need more than one network call per invocation (Stated).
Functions that need more than one network call per invocation
Work whose destinations are not limited to origins on the same distribution and that needs more than one call per invocation sits on the Lambda@Edge side of this table (Inference, from the table row and the list of use cases). The same table states that CloudFront Functions has "No" access to the request body and a "Submillisecond" function duration (Stated). It does not specify whether the function duration includes waiting for network calls (Not stated).
This article does not state that Lambda@Edge is no longer necessary. The comparison table lists "any destination" for Lambda@Edge's network access and retains use cases that require multiple network calls (Stated).
7. Frequently Asked Questions about Network Calls in CloudFront Functions
Q1. Can I directly call an external API URL usingcf.fetch()?No. The main page states that the destination must be an origin already configured on the same distribution, and URLs including hostnames cannot be passed. To call an external API, you must add that API as an origin on the distribution and then refer to it using its
originId.Q2. Can I verify authorization using
cf.fetch() and then send metrics using cf.beacon() in the same invocation?No. The main page states that within a single invocation, only one network call can be made, counting
fetch() and beacon() together. Attempting to pass two cf.fetch() calls to Promise.all() will also result in an error. If you need multiple values within a single request, you can read from KeyValueStore as many times as needed.Q3. If I set the origin response timeout to 30 seconds, will the call also wait up to 30 seconds?
No. The main page states that the response timeout is the one origin setting that does not carry over. Even if you set a longer response timeout on the origin, the call will be cut off after 1 second. The 1 second applies to the whole call, including connection setup and reading the body.
Q4. Can I call a private S3 bucket protected by OAC from a function?
Yes. The main page states that because OAC signs the calls using SigV4, you can call private Amazon S3 buckets without putting credentials in your function code. The signature will follow the origin's signing behavior. If the origin is configured with
no-override, CloudFront will not sign the call if the function adds an Authorization header.Q5. Are viewer cookies and the
Authorization header automatically included in the call?No. The main page states that CloudFront constructs the call from scratch and does not copy viewer headers, cookies, or query strings. The exceptions are
X-Forwarded-For, Via, and CDN-Loop. If the origin requires any specific values, you must include them in the function's headers or body.Q6. Is the call's response cached? Does AWS WAF inspect the call?
No to both. The Limitations section of the main page states that CloudFront does not cache network call responses and that every invocation that reaches a network call makes one. The same section also states that the web ACL for a distribution evaluates viewer requests, not requests sent by functions. Since these are not origin settings, this article does not count them as origin settings that are not inherited.
Q7. Can you verify the behavior of calls using the Test tab in the console?
No, you cannot. The main page states that the
TestFunction API and the Test tab in the console do not support network calls, and that cf.fetch() and cf.beacon() will throw a TypeError. You can test other parts of the function by wrapping the calls in try and catch blocks.Q8. Now that network calls are available, is Lambda@Edge no longer necessary?
This article does not state that. The comparison table describes CloudFront Functions' Network access as one call per invocation to an origin on the same distribution, while Lambda@Edge is described as being able to reach any destination. The same page lists functions that require multiple network calls within a single invocation as a suitable use case for Lambda@Edge.
8. Summary
- Network calls for CloudFront Functions have been available since November 18, 2026, and can be used in viewer request and viewer response functions using JavaScript runtime 2.0.
cf.fetch()reads the response, whilecf.beacon()does not wait for a response. - Destinations are limited to origins already configured on the same distribution, and are referenced by the origin's ID (the "Name" in the console, or the
Idin the API and CloudFormation). URLs including hostnames cannot be passed. Thepathfollows the origin path. - A single invocation allows for one call, counting
cf.fetch()andcf.beacon()together. This limit cannot be increased usingPromise.all(). KeyValueStore can be read any number of times. - OAC signatures, VPC origins, connection reuse, custom origin headers, and origin mTLS all apply to these calls. The developer guide lists five such features, and What's New gives three of them as examples. OAC signatures follow the signing behavior.
- Of the origin settings, only the response timeout is not inherited. Calls are terminated after one second, including connection establishment and body reading.
- Outside the origin settings, call responses are not cached, AWS WAF does not inspect the calls, and viewer headers, cookies, and query strings are not copied, with the exception of
X-Forwarded-For,Via, andCDN-Loop. - If exceptions are not caught, an HTTP 503 error is returned to the viewer. Delivery failures of
cf.beacon()can only be observed throughlogDeliveryErrors. In the test API and console tests, calls result in aTypeError. - Network calls are not available with the free pricing plan, multi-tenant distributions, continuous deployment distributions, or Connection Functions.
- Whether Origin Shield, origin groups, keep-alive settings, connection attempts, and HTTP versions apply to these calls, and whether call wait times are counted towards compute utilization, is not stated in the documents reviewed for this article.
This article is based on the documents as read on December 1, 2026. Quotas, unavailable configurations, and rows in the comparison table may change during and after re:Invent 2026. Therefore, it is necessary to reread the main page and the Quotas page before relying on this information.
In this series, AWS AppConfig AI Configuration Profiles - What the Typed Schema Validates and What customParameters Passes Through covers the values that AppConfig passes to the application and the provider without checking them against the typed schema. Like the viewer headers that this article shows are not copied onto a call, it examines what does not travel across a boundary.
9. References
- Helper methods for network calls - Amazon CloudFront
- Quotas - Amazon CloudFront
- JavaScript runtime 2.0 features for CloudFront Functions - Amazon CloudFront
- Use async and await - Amazon CloudFront
- Restrictions on CloudFront Functions - Amazon CloudFront
- Differences between CloudFront Functions and Lambda@Edge - Amazon CloudFront
- CloudFront flat-rate pricing plans - Amazon CloudFront
- Customize with CloudFront Connection Functions - Amazon CloudFront
- Amazon CloudFront Functions now supports network calls
- Introducing network calls in Amazon CloudFront Functions
- Amazon CloudFront Announces HTTP/2 Support for Connections to Origins
- CloudFront KeyValueStore and Edge Functions Cookbook: A/B Testing, Geo Routing, Feature Flags, and Token Validation
- Amazon CloudFront Origin Architecture Guide - Origin Access Control, Origin Shield, Failover, and VPC Origins
- AWS History and Timeline regarding Amazon CloudFront - Overview, Functions, Features, Summary of Updates, and Introduction
References:
Tech Blog with curated related content
Written by Hidekazu Konishi