Custom integrations
For some frameworks or situations (e.g., edge environments), automatic instrumentation isn't possible. However, you can still manually wrap your handlers to instrument them.
In essence, there are three steps to implement custom integration:
Example integration
In the below example:
We wrap an Express-style request handler to add Appear reporting.
Since Express-style handlers typically use
res.json()orres.send()to set the response body, we use aProxyto intercept and capture the response content.We normalize the
Request,Response, andHeadersobjects so they work seamlessly with Appear'sprocess()function.We use Vercel’s
waitUntil()to ensure the report is sent before the serverless function finishes, without delaying the response to the user.
If you have any queries or require support with the above instructions, please contact us.
Last updated