intercom icon indicating copy to clipboard operation
intercom copied to clipboard

App crashes when using invalid api key format - Android

Open edwinhilgersom opened this issue 10 months ago • 2 comments

Describe the bug A clear and concise description of what the bug is.

Causing app crashes on Android when using an invalid format of the api key.

  • I used the correct api key -> Of course works (expected)
  • Changed 1 character in the api key to invalidate it -> App doesn't crash, intercom just gives the warning "something went wrong" (expected)
  • Removed a few characters from the api key to make it an unaccepted format -> App crashes

To Reproduce Steps to reproduce the behavior:

  1. Use 6.0.2 of @capacitor-community/intercom
  2. Use an invalid format for the android_sdk-[id] api key.
  3. Initialize intercom, by registering a user

Expected behavior A clear and concise description of what you expected to happen. No app crash, just an error.

Screenshots If applicable, add screenshots to help explain your problem.

Smartphone (please complete the following information):

  • Device: [e.g. iPhone6] Pixel 9 Pro
  • OS: [e.g. iOS8.1] Android (api 35)
  • Browser [e.g. stock browser, safari]
  • Version [e.g. 22]

Additional context Add any other context about the problem here.

edwinhilgersom avatar Mar 24 '25 09:03 edwinhilgersom

Maybe not related but I'd rather post it in case it can help.

I add trouble with the app crashing and I found out that

  1. I had to await all the calls to function on Intercom imported from @capacitor-community/intercom (which was not an issue when implementing on iOS).
  2. The loadWithKeys method didn't work for android. I had to go through my capacitor.config.ts file.

Point 1 tells me there is bad error handling in the code generated for android so as soon as there is some kind of error with the plugin configuration and/or usage it crashes the app. A better way to handle this would be to at least show an error message somewhere. Whether in the browser console or in the Android Studio console and then, ideally, not crash, but if necessary, crash.

raphaelparent avatar Mar 27 '25 19:03 raphaelparent

+1. I'd expect that the error in the key wouldn't brick the whole app. Especially for the local development with the ionic capacitor run android --livereload --external. There, we don't expect to populate the environment with real SDK keys.

oleksandr-danylchenko avatar Aug 21 '25 14:08 oleksandr-danylchenko