Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failing to use self hosted server with release APK #18

Closed
fiddur opened this issue Oct 28, 2024 · 11 comments
Closed

Failing to use self hosted server with release APK #18

fiddur opened this issue Oct 28, 2024 · 11 comments

Comments

@fiddur
Copy link

fiddur commented Oct 28, 2024

Describe the bug
I setup self hosted server with docker. I can see it logging when just trying out a url -X POST http://192.168.72.26/api/fetch/something (just making sure I reach the api).
But when setting the API Base URL to http://192.168.72.26 there is nothing in the log indicating that a request reaches is. This is done on the same WIFI, the mobile phone reaches the service with a browser producing a log as well in the api.

I tried creating user account on your server, that worked, so it's not any oddity in the username or password.

To Reproduce
Steps to reproduce the behavior:

  1. Run docker setup with port mapping for port 80.'
  2. Use the APK from the release, set the api base url to http://<ip address>
  3. Try creating a user account

Screenshots
Screenshot_20241028-154057

Smartphone (please complete the following information):

  • Device: Motorola Edge 30 Pro
  • OS: Android 13,
  • Build T1SHS33.35-23-20-16

Additional context
Add any other context about the problem here.

@fiddur
Copy link
Author

fiddur commented Oct 28, 2024

The error message is just Login Failed

Screenshot_20241028-155322

@CoolCoderSJ
Copy link
Owner

CoolCoderSJ commented Oct 28, 2024

Can replicate. This is probably because android:usesCleartextTraffic is missing in the manifest (and therefore blocking plain http traffic). Testing and pushing a fix now.

@CoolCoderSJ
Copy link
Owner

Fixed in v1.3.1. A new APK can be downloaded here

@fiddur
Copy link
Author

fiddur commented Oct 29, 2024

Now it sits for around 30 seconds and then fails.
Still nothing showing in the logs for the docker from the login attempt.
Other attempts like from the mobile browser to GET http://192.168.72.26/api/fetch/st shows up as:

192.168.72.248 - - [29/Oct/2024 12:41:22] "GET /api/fetch/st HTTP/1.1" 405 -

Will the API backend log a failure to login like this? I suspect my appwrite backend is not properly configured, but I wanted to see that it at least reaches the backend before debugging that.

@CoolCoderSJ
Copy link
Owner

It should log a failure- at the very least, you'd see "POST /api/login" 500 or something similar.
Can you try this apk? It's based on this commit - 999d3f6 and shows the full error message when login fails.

@fiddur
Copy link
Author

fiddur commented Oct 30, 2024

It says network error.

But still, Firefox on same device reaches that domain and gives backend error, while the app doesn't.

Screenshot_20241030-120913.png

@CoolCoderSJ
Copy link
Owner

I just noticed the issue- you have 196.168 as the IP in HCGateway, it should be 192.168

@fiddur
Copy link
Author

fiddur commented Oct 30, 2024

Oh damn; I thought I double and triple checked the IP 🙈

192.168.72.248 - - [30/Oct/2024 11:44:46] "POST /api/login HTTP/1.1" 500 -

So, now I get more error output in backend. I guess I need to fix my appwrite stuff.

However, I think appwrite is completely overkill just to get a database. I'm considering making a fork with a minimal API just for the app ingestion, but storing it in a simpler DB that can be accessed directly from looker studio or other apps, instead of having the API serve its own fetching 🤔
For multi-user, it could be a DB wtih clear data ownership.

@CoolCoderSJ
Copy link
Owner

yes, while writing write-access functionality I did realize the app uses barely any of appwrite's functions. A fork would be great! I'm considering migrating to postgres once authentication is complete, simply because it'd involve a lot of rewriting that I want to do after I work on functionality.

In the meantime if you need to get appwrite up, the only configuration you should need is the following:

  • Create a project on the dashboard
  • Create an API key for the project with the database scope

@fiddur
Copy link
Author

fiddur commented Oct 31, 2024

Ok I made my own backend instead; using a psql storage, creating a psql user and database for every new user signing up. To be able to chart up stuff I have to make the types based on each record result type, so I haven't implemented them all yet, just a proof of concept. https://github.com/fiddur/HCGateway/tree/main/api

Using the same App build, connecting with IP and port number works great!

Screenshot_20241031_142234

@CoolCoderSJ
Copy link
Owner

this looks great! Keep in mind I'd prefer not to change the server language, so we won't be able to merge this directly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants