---
title: "Keeping it Bref: Sentry now supports PHP on AWS Lambda"
description: "PHP applications on AWS Lambda lose visibility when requests time out or responses exceed the 6 MB limit, because the Sentry SDK is cut off before it can report. Bref, the open-source project that runs PHP on AWS Lambda, now has an official Sentry integration called sentry/sentry-bref. The integration catches timeouts by hooking into the Bref runtime after PHP-FPM is stopped, and it reports responses too large from the same point. It also creates a transaction per invocation for non-HTTP events like SQS messages and adds cold start spans (lambda.cold-start and bref.startup) to traces. AWS SDK calls can be traced opt-in per client, and every event links to the corresponding CloudWatch log for that invocation."
---

# Keeping it Bref: Sentry now supports PHP on AWS Lambda

[Sentry](https://yomu.fyi/company/sentry) · Matthieu Napoli · Nov 18, 2026

**Type:** Announcement

## Summary

PHP applications on AWS Lambda lose visibility when requests time out or responses exceed the 6 MB limit, because the Sentry SDK is cut off before it can report. Bref, the open-source project that runs PHP on AWS Lambda, now has an official Sentry integration called sentry/sentry-bref. The integration catches timeouts by hooking into the Bref runtime after PHP-FPM is stopped, and it reports responses too large from the same point. It also creates a transaction per invocation for non-HTTP events like SQS messages and adds cold start spans (lambda.cold-start and bref.startup) to traces. AWS SDK calls can be traced opt-in per client, and every event links to the corresponding CloudWatch log for that invocation.

## Context

PHP applications on AWS Lambda face visibility gaps: timeouts cut off the Sentry SDK before it can report, responses over the 6 MB limit fail after PHP returns, and non-HTTP events (SQS, EventBridge, S3) lack a transaction to start. Bref, the open-source project that runs PHP on AWS Lambda (30 billion requests/month, 12 million installs), needed an official integration to capture these unreported errors and provide tracing for cold starts and AWS SDK calls.

## Approach / What changed

The integration hooks into the Bref runtime before and after each invocation. For timeouts, it reports the error from the Bref runtime after PHP-FPM is stopped. It boots the Laravel or Symfony application in that process to use its Sentry client. For cold starts, it measures the cold start in the Bref runtime, stores it in /tmp, and a middleware adds it to the first request’s transaction in PHP-FPM. AWS SDK tracing is opt-in per client via AwsSdkTracer::trace().

## Takeaways

- The integration reports timeouts and responses over 6 MB by hooking into the Bref runtime after PHP-FPM is stopped, which the standard Sentry SDK cannot do.
- For non-HTTP events (SQS, EventBridge, S3), the integration creates one transaction per invocation named after the function and reports exceptions thrown by the handler.
- Cold starts add two extra spans (lambda.cold-start and bref.startup) to traces, but the cold start span starts when PHP starts, excluding the time AWS Lambda spends creating the instance.

## FAQ

### Which frameworks are supported for timeout and large response reporting?

The integration reports timeouts and responses over 6 MB only with Laravel and Symfony. With other frameworks, there is no Sentry client in the Bref runtime to send the error.

### How do I trace AWS SDK calls with this integration?

Pass your AWS SDK clients to AwsSdkTracer::trace(). Only the clients you explicitly pass are traced; framework-created clients (e.g., Laravel's SQS client) are not traced automatically.

### What is not included in the cold start span?

The cold start span starts when PHP starts. The time AWS Lambda spends creating the instance before that is not included. Instances that AWS Lambda initializes in advance are left out because nobody waited for those cold starts.

**Tags:** [AWS Lambda](https://yomu.fyi/topic/aws-lambda), [Bref](https://yomu.fyi/topic/bref), [Laravel](https://yomu.fyi/topic/laravel), [PHP](https://yomu.fyi/topic/php), [Sentry](https://yomu.fyi/topic/sentry)

- Source: [Sentry](https://blog.sentry.io/sentry-bref-php-aws-lambda)
- Source URL: https://blog.sentry.io/sentry-bref-php-aws-lambda
- Ingested by Yomu: 2026-11-18T18:01:11.589Z

[Read original post](https://blog.sentry.io/sentry-bref-php-aws-lambda)
