Closed Drb0IENO7JegIkJTGpIJYLvQrCNw3l82v2wgPnJ closed 5 years ago
Any clues? Debug logs don't show the nature of the error. I know it's not an issue with my let's encrypt certificates since I'm passing the fullchain.pem and can login to the web vault from the tablet using firefox browser. Also, checking with https://www.digicert.com/help/ shows my certs are all fine.
So if it isn't a certificate issue (as I read in many closed posts) I must be doing something wrong when trying to set the BaseAddress as described above.
Is there another way to permanently set the self-hosted URL as BaseAddress in the code?
Thanks
Without knowing what your server's URL is, I'm not sure. Can't you just change from login settings page? Why are you needing to compile locally?
Thanks for the reply @kspearrin
I'll email you the URL since I don't want to expose it in a public place.
The reason I want to compile locally is to be able to have the app go directly to my self-hosted server without having to fill out anything. I was able to do this in the past without much issue but this time I'm getting that unhelpful error message. Not sure what changed since I last compiled a working version last summer.
I'll email you the URL now using your website form
Just emailed you the URL
I am not sure how the bitwarden_rs server works, but normally you just need to configure the API and identity server URLs. Try debugging the mobile app to see why it is failing.
The bitwarden_rs server works fine with the app if I set the Server URL in the login settings page, so I don't think there's any compatibility problem. What I don't understand is why I get the connection error message if I set the BaseAddress URL to my server URL.
Unfortunately the debug logs don't really show anything.
[Mono] DllImport searching in: '__Internal' ('(null)'). [Mono] Searching for 'java_interop_jnienv_call_long_method_a'. [Mono] Probing 'java_interop_jnienv_call_long_method_a'. [Mono] Found as 'java_interop_jnienv_call_long_method_a'.
[art] JNI RegisterNativeMethods: attempt to register 0 native methods for md51558244f76c53b6aeda52c8a337f2c37.TableViewRenderer
[art] JNI RegisterNativeMethods: attempt to register 0 native methods for md50a3fb0d815bba0cfe9c20906cbbc65da.ExtendedTableViewRenderer
[art] JNI RegisterNativeMethods: attempt to register 0 native methods for md51558244f76c53b6aeda52c8a337f2c37.BaseCellView
[art] JNI RegisterNativeMethods: attempt to register 0 native methods for md51558244f76c53b6aeda52c8a337f2c37.TextCellRenderer_TextCellView
[Mono] DllImport searching in: 'Internal' ('(null)').
[Mono] Searching for 'java_interop_jnienv_set_float_field'.
[Mono] Probing 'java_interop_jnienv_set_float_field'.
[Mono] Found as 'java_interop_jnienv_set_float_field'.
[art] JNI RegisterNativeMethods: attempt to register 0 native methods for md51558244f76c53b6aeda52c8a337f2c37.CellRenderer_RendererHolder
[art] JNI RegisterNativeMethods: attempt to register 0 native methods for md50a3fb0d815bba0cfe9c20906cbbc65da.ExtendedEntryRenderer
[Mono] DllImport searching in: 'Internal' ('(null)').
[Mono] Searching for 'java_interop_jnienv_call_static_long_method_a'.
[Mono] Probing 'java_interop_jnienv_call_static_long_method_a'.
[Mono] Found as 'java_interop_jnienv_call_static_long_method_a'.
[Choreographer] Skipped 38 frames! The application may be doing too much work on its main thread.
[View] requestLayout() improperly called by md51558244f76c53b6aeda52c8a337f2c37.ScrollViewContainer{e5fd2a6 V.E...... ......ID 0,0-720,1120} during layout: running second layout pass
[View] requestLayout() improperly called by md58432a647068b097f9637064b8985a5e0.NavigationPageRenderer{ff1e707 V.E...... ........ 0,0-720,1232 #9} during second layout pass: posting in next frame
Thread finished:
[Mono] Unloading image System.Globalization.dll [0x5a90ab00].
[Mono] Config attempting to parse: 'System.Globalization.dll.config'. [Mono] Config attempting to parse: '/Users/builder/jenkins/workspace/xamarin-android-d15-9/xamarin-android/external/mono/sdks/out/android-armeabi-v7a-release/etc/mono/assemblies/System.Globalization/System.Globalization.config'.
[Mono] Prepared to set up assembly 'System.Numerics' (System.Numerics.dll) [Mono] Assembly System.Numerics[0x5a1bc880] added to domain RootDomain, ref_count=1 [Mono] AOT: image 'System.Numerics.dll.so' not found: dlopen failed: library "/data/app/com.x8bit.bitwarden-1/lib/arm/libaot-System.Numerics.dll.so" not found [Mono] AOT: image '/Users/builder/jenkins/workspace/xamarin-android-d15-9/xamarin-android/external/mono/sdks/out/android-armeabi-v7a-release/lib/mono/aot-cache/arm/System.Numerics.dll.so' not found: dlopen failed: library "/data/app/com.x8bit.bitwarden-1/lib/arm/libaot-System.Numerics.dll.so" not found [Mono] Config attempting to parse: 'System.Numerics.dll.config'. [Mono] Config attempting to parse: '/Users/builder/jenkins/workspace/xamarin-android-d15-9/xamarin-android/external/mono/sdks/out/android-armeabi-v7a-release/etc/mono/assemblies/System.Numerics/System.Numerics.config'.
Loaded assembly: System.Numerics.dll [External]
[Mono] Prepared to set up assembly 'System.Data' (System.Data.dll) [Mono] Assembly System.Data[0x5a57fa00] added to domain RootDomain, ref_count=1 [Mono] AOT: image 'System.Data.dll.so' not found: dlopen failed: library "/data/app/com.x8bit.bitwarden-1/lib/arm/libaot-System.Data.dll.so" not found [Mono] AOT: image '/Users/builder/jenkins/workspace/xamarin-android-d15-9/xamarin-android/external/mono/sdks/out/android-armeabi-v7a-release/lib/mono/aot-cache/arm/System.Data.dll.so' not found: dlopen failed: library "/data/app/com.x8bit.bitwarden-1/lib/arm/libaot-System.Data.dll.so" not found [Mono] Config attempting to parse: 'System.Data.dll.config'. [Mono] Config attempting to parse: '/Users/builder/jenkins/workspace/xamarin-android-d15-9/xamarin-android/external/mono/sdks/out/android-armeabi-v7a-release/etc/mono/assemblies/System.Data/System.Data.config'.
Loaded assembly: System.Data.dll [External]
[System] ClassLoader referenced unknown path: /system/framework/tcmclient.jar
[Choreographer] Skipped 90 frames! The application may be doing too much work on its main thread.
Thread started:
Thread finished:
and after trying to login again:
A OnStart
[Mono] DllImport searching in: 'e_sqlite3' ('./libe_sqlite3.so').
[Mono] Searching for 'sqlite3_column_int'.
OnStart
A OnResume
[View] requestLayout() improperly called by md51558244f76c53b6aeda52c8a337f2c37.ScrollViewContainer{82e9b16 V.E...... ......ID 0,0-720,1232} during layout: running second layout pass
[View] requestLayout() improperly called by md58432a647068b097f9637064b8985a5e0.NavigationPageRenderer{7299589 V.E...... ........ 0,0-720,1232 #1f} during second layout pass: posting in next frame
[View] requestLayout() improperly called by md51558244f76c53b6aeda52c8a337f2c37.ScrollViewContainer{8fbd588 V.E...... ......ID 0,0-720,1120} during layout: running second layout pass
[View] requestLayout() improperly called by md58432a647068b097f9637064b8985a5e0.NavigationPageRenderer{a6fb77d V.E...... ........ 0,0-720,1232 #27} during second layout pass: posting in next frame
Thread finished:
I was hoping the debug logs would show some useful info. Checking server side I see that the attempted login never even reaches the server, so I would suspect some problem on the client.
Any clues?
Thanks
Try setting breakpoints. For example, here: https://github.com/bitwarden/mobile/blob/master/src/App/Repositories/ConnectApiRepository.cs#L52 or here https://github.com/bitwarden/mobile/blob/master/src/App/Repositories/ConnectApiRepository.cs#L73
Thanks Kyle.
I've done as you said and here's the results from both breakpoints L52 is here https://paste.ee/d/Evc19/0 and L73 is here https://paste.ee/d/I3UGF
Any clues?
What is the exception being caught on 73? Might need to change it to catch (Exception e)
so that you can inspect the exception
Thanks for your help @kspearrin
I caught some exceptions relating to Newtonsoft.Json which could be the cause of the problem. It seems this nougat package is having problems parsing the URL I inserted for my self-hosted server, which then leads it to fail later when trying to connect.
Newtonsoft.Json.JsonReaderException: Unexpected character encountered while parsing value: <. Path '', line 2, position 12.
at Newtonsoft.Json.JsonTextReader.ParseValue () [0x002b3] in
and also
Bit.App.Repositories.BaseApiRepository.
Newtonsoft.Json.JsonReaderException: Unexpected character encountered while parsing value: <. Path '', line 2, position 12.
at Newtonsoft.Json.JsonTextReader.ParseValue () [0x002b3] in
and
Newtonsoft.Json.JsonReaderException: Unexpected character encountered while parsing value: <. Path '', line 2, position 12.
at Newtonsoft.Json.JsonTextReader.ParseValue () [0x002b3] in
Bit.App.Repositories.ConnectApiRepository.PostTokenAsync() in /mobile/src/App/Repositories/ConnectApiRepository.cs:52
Any idea how to solve this?
Thanks
Why is it having problems parsing your URL? What's non-standard about it?
That’s what I’d like to know too. Nothing special about the URL. It’s a standard one with .io TLD
And the fact it works fine when I change it manually in the login settings section is even more baffling.
Sent from my mobile device
On 14 Mar 2019, at 20:13, Kyle Spearrin notifications@github.com wrote:
Why is it having problems parsing your URL? What's non-standard about it?
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.
This seems like it maybe related
Hi @kspearrin
Finally was able to dig deeper and found out the problem. The problem is that somewhere your code is adding an extra / at the end of the BaseAddress so it then has a double // in the address which obviously fails (see below)
{Method: POST, RequestUri: 'https://my.domain.com//connect/token', Version: 1.1, Content: System.Net.Http.FormUrlEncodedContent, Headers: { Device-Type: 0 Accept: application/json Content-Type: application/x-www-form-urlencoded Content-Length: 274 }}
Now I'm 100% positive that in BaseAddress I've set the URL without the trailing / so somewhere it is being added by mistake.
Any idea where this is happening?
Cheers
probably in the repositories themselves. that connect call happens in the ConnectApiRepository that I linked above.
That's what I thought originally but no matter what I end up putting in here it always gives me the POST with the BaseURL and the double forward slash which always leads to the connection error. RequestUri = new Uri(string.Concat(client.BaseAddress, "/connect/token")),
It seems almost as if VS is ignoring my changes even though I clean and build from scratch with different strings in RequestUri but none of them seem to be used.
Very confused as to why hardcoding something like this doesn't work:
RequestUri = new Uri("https://my.domain.com/connect/token"),
Any ideas?
Just had to adjust the paths and now it works.
As described in the title, I just compiled the app for Android and followed the instructions in the wiki to change the BaseUrl to my self-hosted bitwarden_rs installation.
Specifically I changed https://github.com/bitwarden/mobile/blob/6d11921f45ca210b31387e49f41d30c05fe4978c/src/App/Utilities/ApiHttpClient.cs#L40
to BaseAddress = new Uri("https://my.selfhosted.com"); // Production
and
in https://github.com/bitwarden/mobile/blob/6d11921f45ca210b31387e49f41d30c05fe4978c/src/App/Utilities/IdentityHttpClient.cs#L40
to BaseAddress = new Uri("https://my.selfhosted.com"); // Production
After compiling and running it on my android tablet (8.1) I always get the error message "An error has occurred: There is a problem connecting to the server"
I tried in the app going into Settings and changing the Server URL there under self-hosted environment to https://my.selfhosted.com and it works fine as expected.
Am I doing something wrong? How can I set the BaseURL without having to open the app, go to settings and type it in there?
Thanks