Debugging Tip: The `trace_id` in the Forge Bridge GraphQL request

TLDR: When you use the Forge Bridge to call your backend, it will do a GraphQL request. The response of that request has a trace_id, that lets you find related logs in your backend.

When you use Forge bridge to call functions/backend, it translates to GraphQL queries. So, in your network inspector you then can look out for these and inspect them. So you can see what was requested and actually sent back. Especially in error cases.

A important detail is that the response has a trace_id field.

This trace_id is passed through the layers. Logs are tagged with this id, so you can find the logs related to this that specific request. You can then find the backend logs for this either with the developer console.

PS: I couldn’t find a way to get the specific logs via the trace id in the forge logs command. Let me know if there is a way, or even a better way overall to trace requests.

5 Likes

Hey @RomanStoffel

The forge logs command currently does not support the trace_id option. It supports only the invocation_id parameter. To correlate logs, use the trace_id in the developer console log viewer and obtain the corresponding invocation_id from the relevant log entry.

1 Like