Do this with AI
Install the launch-platform skill from Contentstack agent skills and connect the Launch Deploy Helper profile in MCP Profile Hub. Then ask your agent:
Pull the server logs for my latest production deployment on Launch, group the edge function errors by message, and tell me which ones match a known platform limit.
New to this? Set up your AI workbench first.
Logs, debugging and limits
Edge problems are hard to see from the browser. A 500 from the edge, a page that won't update, or a redirect that fires for the wrong visitors all look the same in a network tab. Launch gives you three places to look: deployment logs for build and bundling errors, server logs for runtime output, and response headers for cache behavior. This chapter shows how to use each one, how to keep logs longer than a day, and which limits cause most failures.
What you'll learn
How to read edge and server logs in the UI, the CLI and the API
How to forward logs to your own platform with Log Targets
How to diagnose CFL-0001 and failed edge deployments
Which platform limits apply to edge functions, routing and environment variables
The mistakes that show up most often in production
Read server logs
Launch concept: server logs hold runtime output from your SSR app, Cloud Functions and edge functions for the latest deployment. Every console.log, console.error and unhandled exception from functions/[proxy].edge.js lands there.
In Launch, open the environment and go to the server logs. Retention is 24 hours, with up to 5,000 recent entries viewable.
From a terminal, the CLI fetches the same logs. The Launch commands are not part of the default CLI install; they come from the @contentstack/cli-launch plugin, so install it once:
csdx plugins:install @contentstack/cli-launch
# Server logs (the default type)
csdx launch:logs --environment production --type s
# Deployment (build) logs for a specific deployment
csdx launch:logs --environment production --deployment <deployment-uid> --type dRun these from a folder that has the .cs-launch.json file the CLI created, or pass --org and --project.
For scripts, the Launch API returns server logs per deployment and can filter to edge output only:
curl -G "https://launch-api.contentstack.com/projects/$PROJECT_UID/environments/$ENVIRONMENT_UID/deployments/$DEPLOYMENT_UID/logs/server-logs" \
-H "Authorization: Bearer $LAUNCH_TOKEN" \
--data-urlencode "source=edge-logs" \
--data-urlencode "search=TypeError" \
--data-urlencode "limit=200"source is edge-logs for edge functions or origin for SSR and Cloud Functions. search matches text in the log message.
Log with structure. A JSON line with the path and the decision you made is easier to search than free text:
export default async function handler(request, context) {
const url = new URL(request.url);
try {
const response = await fetch(request);
if (response.status >= 500) {
console.error(JSON.stringify({ event: 'origin_error', path: url.pathname, status: response.status }));
}
return response;
} catch (error) {
console.error(JSON.stringify({ event: 'edge_exception', path: url.pathname, message: String(error) }));
return new Response('Service unavailable', { status: 503, headers: { 'cache-control': 'no-store' } });
}
}The try/catch turns an unhandled exception into a controlled 503 with a log line you can find.
Forward logs with Log Targets
Server logs are short-lived on purpose. For history, alerting and correlation with the rest of your stack, set up a Log Target. It forwards logs over OTLP (OpenTelemetry Protocol) to any endpoint that accepts it, either directly to your log provider or through an OpenTelemetry Collector.
Create one in Launch under Settings > Log Targets:
Give the target a name and pick the data types: Server Logs (SSR, Cloud Functions and edge functions) and/or Traffic Logs (request and response metadata from the CDN edge).
Choose All Projects & Environments or a Custom set of projects and environments.
Set the delivery protocol (gRPC or HTTP), the endpoint URL, any authentication headers your provider needs, and the payload format. JSON is only available over HTTP.
Run Test Connection. A target saved without a successful test stays disabled until you verify it.
Each combination of environment and data type can be covered by only one Log Target. One target can forward server logs for production while another forwards traffic logs for the same environment.
Logs are forwarded exactly as your code wrote them. Launch does not mask anything, so keep tokens and personal data out of console.log.
Debug common errors
Internal server error CFL-0001. Your edge function threw an unhandled exception. Open server logs filtered to edge output. Typical causes are calling request.json() on a request without a body, reading a missing context.env value, or mutating a Request or Response instead of creating a new one.
The deployment fails at the edge function step. The deployment logs name the reason. The usual ones:
The minified bundle of your code and its imports is larger than 1 MiB.
A dependency uses Node.js APIs that aren't in the WinterCG minimum set.
Bundling failed because of a syntax error or a missing dependency in package.json.
An environment variable contains quotes, extra spaces or escaped newlines, for example key="1234" instead of key=1234.
New code only works some of the time. Edge functions roll out to all points of presence within about 60 seconds. During that window, and for logs, some requests still hit the previous deployment. Wait a minute before you conclude a fix didn't work.
A page is stale or a fix doesn't show. Look at the response headers. cf-cache-status: HIT with a large age means you are seeing a cached copy. Revalidate the path as described in chapter 3, then check your Cache-Control.
A rule in launch.json doesn't run. Check the redirect and rewrite counts in the deployment logs, then check whether the link is a client-side navigation that never reaches the edge.
Limits to remember
Area | Limit |
|---|---|
Edge function memory | 128 MB per instance |
Edge function bundle | 1 MiB (1,024 KiB) minified |
Edge function startup | 400 ms for the global scope |
Edge function duration | No limit while the client stays connected |
Edge function environment variables | Up to 64, each up to 5 KB |
Environment variables per environment | 128, with 14 KB in total |
Environment variables with Cloud Functions | 4 KB in total |
launch.json file size | 5 MB |
Redirect or rewrite source and destination | 512 characters each |
Server log retention | 24 hours, up to 5,000 entries viewable |
Launch API rate limit | 10 requests per second per organization |
The 400 ms startup limit is about code outside the handler. Don't parse a large JSON file or build a big lookup table at the top level of the module.
Running edge functions locally with the CLI is not supported. csdx launch:functions serves Cloud Functions only. Keep the handler logic in small, pure functions you can unit test with Node's built-in Request and Response, and deploy to a preview environment for the rest.
Where people get confused
Logging secrets. A console.log(request.headers) prints cookies and auth headers into your logs and into every Log Target. Log the fields you need.
Caching error responses from the edge. A 403 or 503 returned by your edge function without cache-control: no-store can be cached like any other response.
Blocking or trusting cache priming. Priming requests come from platform IP addresses with the Contentstack-Launch/CachePrimingAgent/1.0 user agent. A WAF or IP allowlist in front of your site can block them, so priming silently does nothing. Allow them, but don't treat that user agent as proof of anything, because any client can send it.
Key takeaways
Check deployment logs for bundling errors and server logs for runtime errors, filtered to edge output.
Use csdx launch:logs --type s or the server-logs API with source=edge-logs in scripts.
Wrap edge logic in try/catch and log JSON lines so CFL-0001 becomes a searchable error.
Set up a Log Target over OTLP before you need history older than 24 hours.
Keep the edge bundle under 1 MiB, global scope work under 400 ms, and environment variables free of quotes and escaped newlines.
Frequently asked questions
How long does Launch keep server logs?
Server logs are kept for 24 hours, and you can view up to the 5,000 most recent entries. Use a Log Target for longer retention.
What does Internal server error CFL-0001 mean?
It usually means your edge function threw an unhandled exception. Check the Server Logs of the environment for the stack trace.
Why do I still see old edge function behavior after a deployment?
Edge functions sync to all points of presence within about 60 seconds. During that window some locations still run the previous code.
Which logs can a Log Target forward?
Server logs, which include SSR, Cloud Function and edge function output, and traffic logs with request and response metadata from the CDN edge.