Send crashes/stack traces directly over API

I have an Android app that cannot connect to the internet directly. It’s connects to a device that is allowed only to contact our servers over the internet. We are collecting crash logs on our servers from the app. The crash logs are Kotlin/Java and the server is Python.

Is there an API where I can send the stack traces to where they would then be treated as regular crashes/stack traces by Sentry?

Sentry ingests events which contain the stack traces. Sending “just the stack trace” would require a valid Sentry event that has only the stack trace.

This use case sounds like Relay fits as a solution but the project is a work in progress.

1 Like

/cc @jauer in case he has anything more to say on Relay.

@MichaelTS As Bruno mentioned, we’re working on a proxy service called Relay which you can use to forward your events. You can follow the documentation (and Configuration Options) to set it up in “Proxy mode”:

relay:
  mode: proxy
  upstream: "https://sentry.io/"
  host: "0.0.0.0"
  port: 80

However, in this setup, Relay does not give you substantial benefits over running a regular reverse proxy on one of your servers. If you plan to submit the errors or events delayed, then you will have to build a custom service for the time being.

To answer the initial question, you’re looking for our store API, which the SDKs also use to submit errors including their stack traces. Provided you send a compatible payload, this will create events just like from any other SDK. These resources might be useful:

To sum this up, provided you have a DSN:

  • Send a POST request to https://sentry.io/api/<project_id>/store/
  • Send an X-Sentry-Auth header containing at least sentry_key from your DSN
  • In the payload, exclude an exception with a stacktrace with your frames.

Hope that this points you in the right direction.

2 Likes

Thanks, I’ll give that a try