CapacitorHttp plugin error

On Android devices I am getting the following errors. This happens after an unauthorized message is received due to an incorrect login.

It is probably a bug in the CapacitorHttp plugin. I see that you have several debug loggin enabled, does the request options include the content-length header?

It does not. Also the length isn’t always the same. Sometimes its 89 bytes and sometimes it’s 12.

It also seems to happen if I simply log in and log out then log in again.
. If I try and login again I get the TypeError error again and the app is hung here until I restart it. Also when I try again it does not actually try and connect to the server so the issue appears to be local.

Here are some additional errors I found it was generating on load. They do not appear to cause an issue and the app works normally until I get an unauthorized from the server. For example I logout and put in an incorrect password.

I am also getting these errors from Logcat. This one appears on app load

This one appears after I get an “unauthorized” from the server and hangs the app.
It also seems to happen if I simply log in and log out then log in again.

Dug some more. Found another LogCat error.

@englandscott
Are you using http plugin just for login?
Or is there another reason?

It has to be used throughout the app for iOS or you cannot maintain cookies properly cause, Apple.

It’s something I couldn’t find how to fix:

The workaround is disabling http plugin on Android and enable it on iOS (Cookies plugin works perfectly fine on Android)

I found this:

Sometimes, project-specific configurations in Gradle may conflict with configurations required for the HTTP plugin. For example, certain Gradle configurations may affect how HTTP requests are handled in the application.

But I think this is an specific gradle problem case and I would like to help, but won’t be possible unless I see all the files.
I’m on vacations right now, without Wappler until next monday.
It would be good if you could share a repository where the gradle files can be seen (I think there is no sensitive information there, but check it out).
If you can’t do it, I can set one up next week with a security provider and do some testing

Sorry if this doesn’t help, maybe @patrick can help you more than I can.

The error seems to generated from somewhere in the Java code. Disabling the plugin would probably solve the problem for Android. Check if all modules are on the latest version, it is possible that it was fixed. There is not much we can do when the problem is generated by a 3rd party plugin.

Is there a way to only have Wappler use the plugin with iOS and not Android when it builds other then manually editing the individual configs?