Photo of Torben Hansen

A TechBlog by Torben Hansen

Freelance Full Stack Web Developer located in Germany.
I create web applications mainly using TYPO3, PHP, Python and JavaScript.
Home Archive Tags

TYPO3 Sentry Integration: Testing and Debugging with cURL

Configuring the TYPO3 extension sentry_client is a straightforward process that ensures seamless integration with Sentry, the robust error tracking and monitoring platform. Once the sentry_client extension is configured, it becomes crucial to verify whether Sentry is successfully receiving events from your TYPO3 instance. The documentation describes exactly, how to test this by using the following TypoScript snippet:

page = PAGE
page.20 = USER
page.20 {
  userFunc = Networkteam\SentryClient\Client->captureException

This will result in TYPO3 throwing an exception, since the called captureException function expects arguments, which are not provided. So far, so good. But what, if Sentry does not recieve the expected event?

Creating a test event in Sentry using cURL

To ensure the server’s ability to connect to Sentry and generate test events, the versatile cURL command can be employed as a valuable tool. cURL facilitates the simulation of HTTP requests, making it an effective means to verify the communication between your server and the Sentry platform.

curl -X POST --data '{ "exception": [{ "type": "Sentry curl test request ", "value": "This is a test request to sentry sent by curl"}] }' \
	-H 'Content-Type: application/json' \
	-H "X-Sentry-Auth: Sentry sentry_version=7, sentry_key=<sentry-key>, sentry_client=raven-bash/0.1" https://<sentry-url>/api/<project-id>/store/

Replace the following values:

If the creation of the test event was successful, you will receive an event id from sentry as response as shown below:

curl -X POST --data '{ "exception": [{ "type": "Sentry curl test request ", "value": "This is a test request to sentry sent by curl"}] }' \                                                                                          127 ↵
        -H 'Content-Type: application/json' \
        -H "X-Sentry-Auth: Sentry sentry_version=7, sentry_key=123456789012345678901234567890, sentry_client=raven-bash/0.1" https://my.sentry.tld/api/1/store/

A look in the Sentry UI for the project will then also prove, that the event has been created successfully

Sentry test event

What if the Sentry UI does not show the expected event?

If the Sentry UI does not show the event for a new created project, most likely something with the logging in Sentry is wrong. If you use Sentry on premise, try to restart sentry, so all docker containers are restarted.