We’ve been having issues with getting the Android SDK to send events to an on-premise setup.
I created a brand new Kotlin android application and followed the instructions here:
I was able to send events to sentry.io cloud platform with no problems. I then setup a brand new on-premise setup locally (20.10.1) and I could not get android events to show up. The logs showed no connection attempt which is making me think that theres an issue with the android sdk connecting to non-cloud DSNs. To confirm my on-premise setup I whipped up a new flask application and was able to send a sentry event through that.
+1
We are also in the same boat. Able to send events from iOS application however android fails.The error in my logs looks like:
E/Sentry: Envelope submission failed
We updated our server to the latest version i.e 20.10.1
It works for on-cloud but fails for on-premise.
D/Sentry: Adding Envelope to offline storage: /data/user/0/com.example.sentrytest/cache/sentry/9fd61b7b-cf94-47b8-a094-69b86f58d176.envelope
I/Sentry: No permission (ACCESS_NETWORK_STATE) to check network status.
D/Sentry: io.sentry.hints.SessionStartHint is not Retryable
E/Sentry: Envelope submission failed
java.lang.IllegalStateException: Sending the event failed.
at io.sentry.transport.AsyncConnection$EnvelopeSender.flush(AsyncConnection.java:258)
at io.sentry.transport.AsyncConnection$EnvelopeSender.run(AsyncConnection.java:212)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:462)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at java.lang.Thread.run(Thread.java:923)
Caused by: java.net.ConnectException: Failed to connect to /0.0.0.0:9000
at com.android.okhttp.internal.io.RealConnection.connectSocket(RealConnection.java:147)
at com.android.okhttp.internal.io.RealConnection.connect(RealConnection.java:116)
at com.android.okhttp.internal.http.StreamAllocation.findConnection(StreamAllocation.java:186)
at com.android.okhttp.internal.http.StreamAllocation.findHealthyConnection(StreamAllocation.java:128)
at com.android.okhttp.internal.http.StreamAllocation.newStream(StreamAllocation.java:97)
at com.android.okhttp.internal.http.HttpEngine.connect(HttpEngine.java:289)
at com.android.okhttp.internal.http.HttpEngine.sendRequest(HttpEngine.java:232)
at com.android.okhttp.internal.huc.HttpURLConnectionImpl.execute(HttpURLConnectionImpl.java:465)
at com.android.okhttp.internal.huc.HttpURLConnectionImpl.connect(HttpURLConnectionImpl.java:131)
at io.sentry.transport.HttpTransport.createConnection(HttpTransport.java:245)
at io.sentry.transport.HttpTransport.send(HttpTransport.java:251)
at io.sentry.transport.AsyncConnection$EnvelopeSender.flush(AsyncConnection.java:239)
at io.sentry.transport.AsyncConnection$EnvelopeSender.run(AsyncConnection.java:212)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:462)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at java.lang.Thread.run(Thread.java:923)
Sentry if it would help I’d be willing to send my complete android application to you so that you can run it locally. It is a simple default application with absolutely nothing in it (and thus is easily replicable).
I guess 0.0.0.0 is a broadcast intranet address, not assigned to any particular server. It is an invalid address. You should use a valid ip address, such as 127.0.0.1 for your local server.
Switched over to 127.0.0.1 and same issue. Remember I am also having issues connecting to an https:// remote on-premise as well.
D/Sentry: Adding Envelope to offline storage: /data/user/0/com.example.sentrytest/cache/sentry/37a18d81-4718-40ff-beba-ac8996258d19.envelope
I/Sentry: No permission (ACCESS_NETWORK_STATE) to check network status.
D/Sentry: io.sentry.hints.SessionStartHint is not Retryable
E/Sentry: Envelope submission failed
java.lang.IllegalStateException: Sending the event failed.
at io.sentry.transport.AsyncConnection$EnvelopeSender.flush(AsyncConnection.java:258)
at io.sentry.transport.AsyncConnection$EnvelopeSender.run(AsyncConnection.java:212)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:462)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at java.lang.Thread.run(Thread.java:923)
Caused by: java.net.ConnectException: Failed to connect to /127.0.0.1:9000
at com.android.okhttp.internal.io.RealConnection.connectSocket(RealConnection.java:147)
at com.android.okhttp.internal.io.RealConnection.connect(RealConnection.java:116)
at com.android.okhttp.internal.http.StreamAllocation.findConnection(StreamAllocation.java:186)
at com.android.okhttp.internal.http.StreamAllocation.findHealthyConnection(StreamAllocation.java:128)
at com.android.okhttp.internal.http.StreamAllocation.newStream(StreamAllocation.java:97)
at com.android.okhttp.internal.http.HttpEngine.connect(HttpEngine.java:289)
at com.android.okhttp.internal.http.HttpEngine.sendRequest(HttpEngine.java:232)
at com.android.okhttp.internal.huc.HttpURLConnectionImpl.execute(HttpURLConnectionImpl.java:465)
at com.android.okhttp.internal.huc.HttpURLConnectionImpl.connect(HttpURLConnectionImpl.java:131)
at io.sentry.transport.HttpTransport.createConnection(HttpTransport.java:245)
at io.sentry.transport.HttpTransport.send(HttpTransport.java:251)
at io.sentry.transport.AsyncConnection$EnvelopeSender.flush(AsyncConnection.java:239)
at io.sentry.transport.AsyncConnection$EnvelopeSender.run(AsyncConnection.java:212)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:462)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at java.lang.Thread.run(Thread.java:923)
@sayeghr your DSN looks invalid to me. It should never be 0.0.0.0 or 127.0.0.1 as the former one is not even a valid IP address and the latter will always point to the local host, requiring the Sentry server to be running on the very same machine that your application is running (strongly recommend against doing this).
My guess is your system.url-prefix setting is not correct, hence you are seeing/getting incorrect DSN values from your Sentry instance. You can read more about this here: https://develop.sentry.dev/config/#general
I’m running a local sentry server on my local machine to reproduce this issue. This local setup works when I test against a flask/python setup. I strongly believe there is an issue with the latest Android SDK when connecting to onpremise sentry setups as Im having issues as follows:
Cannot send events to a local on-premise setup (0.0.0.0, 127.0.0.1)
Cannot send events to a remote on-premise setup, (https://sentry.[mydomain].com)
These issues are not there for Python Flask SDK and Python Django SDK, or iOS SDK (see other commenters above).
Im guessing the Android SDK developers on the Sentry team do not test against a local on-premise but are connecting to a development cloud setup and thats why they arent running into the issue?
Sorry if I sound frustrated but this issue could be replicated on your end by simply creating a new default android application and pointing it to a default sentry on-premise (20.10.1)
Alright then I’ll be looping in @bruno-garcia, one of our Android experts
No need to be sorry, I’d be frustrated if I were you too! The reason is most of the time these issues turn out to be configuration issues on the operator’s end. This indeed sounds like something to do with the Android SDK but we may still be missing something. Let’s see what @bruno-garcia says.
I guess 0.0.0.0 is a broadcast intranet address, not assigned to any particular server. It is an invalid address. You should use a valid ip address, such as 127.0.0.1 for your local server.
well, firstly, a valid server address can not be 0.0.0.0, which is reserved and of broadcast usage.
secondly, 127.0.0.1 is also a reserved local loop-back address, used to access the local server only.
You need to set DSN using the valid address of your server, on whom on-premise is installed. while local server address 127.0.0.1 may work for other integration, while for android, who is in certain way a linux server, will treat this 127.0.0.1 as its own android device instead of your on-premise server.
So please use ifconfig on linux, or ipconfig on windows, or other similar to get the real IP address, and update your DNS setting accordingly.
When I used my local ip address (e.g. 192.168.13.7) I was actually able to send an event to onpremise sentry. I’m still having problems sending to an onpremise sentry hosted over https.
@liangrong@bruno-garcia Hey team, I noticed theres a newer version of the android SDK (3.2.0), after upgrading to 3.2.0 in my test repository I was able to send events to my HTTPS hosted on-premise. There is definitely something funky going on in 3.1.0 thats resolved in 3.2.0. Just a heads up!