#273-Create-service-to-enable-connection-to-database #451
Labels
No labels
_CRITICAL_
API
app
backEnd
Blocked-waiting-for-further-changes
bug
bug-only-on-server-for-mobile-not-webpage
Bug-Report-After-Merge
cleanup
close
design
duplicate
enhancement
feature request
frontEnd
further-changes-needed
future-problem-not-fixint-this-period
help wanted
invalid
last-week-issue-to-fix
library
low-priority
needs input
needs review
not-implemented.
project documentation
question
research
reviewed
Script
security
SQL
style
Team 1
Team 2
team leaders
test-creation
testing
topLevel
unassigned
Under-review
wontfix
No milestone
No project
No assignees
6 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Andras/BoundlessFlowCampus2K!451
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "#273-Create-service-to-enable-connection-to-database"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
I know the commit is on the larger side and i am sorry
about that :(
+ Added the small feature loginService + How it works + Endpoints -> AuthService -> DatabaseQueries->DATABASE + DATABASE -> DatabaseQueries->AuthService->Endpoint->frontend + This is done to separate the different layers. + Entrypoint receives requests + AuthService should apply all logic + DatabaseQueries should only fetch data + Tested on my own computer Fedora 43 using curl + get container ip using this command ``` bash docker inspect -f '{{range.NetworkSettings.Networks}}{{.IPAddress}}{{end}}' container_name_or_id ``` + possible to create a user using endpoint ``` bash curl -X POST http://172.18.0.3:8080/auth/SignUp \ -H "Content-Type: application/json" \ -d '{ "Username": "jag orkar inte", "Firstname": "Eric", "Lastname": "Grandinger", "Email": "eric@example.com", "Password": "Let me in" }' ``` + possible to sign in using endpoint ``` bash curl -X POST http://172.18.0.10:8080/auth/login \ -H "Content-Type: application/json" \ -d '{"Username": "jag orkar inte", "Password": "Let me in"}' }' ``` + Acess not granted if wrong password is used I know the commit is on the larger side and i am sorry about that :(WINDOWS 11
I've maybe done something wrong but I get this when trying to sign up an account:
I have tested compiling and running the application. It runs successfully
@b24hugst wrote in #451 (comment):
The error suggest that the problem is related to trying to login to the database scram-sha-256 postgresql. The code i wrote fetches the login cridentials from the .env file
My .env file has the following structure
The structure the you recive back .
Suggests that your reach the endpoint put.
Did @c24elipe run on Windows? Otherwise it would be good to have one more person try on a windows machine to see if it's just me or not. I have correct .env file and all but I can't seem to get it to work for some reason although everything looks clean.
@b24hugst, I used Arch Linux. That may be where problems stem...
This is long sorry
Windows 11
Theres an issue with the windows rebuild where the path to the dockerfile is wrong. Accessing the service from curl on powershell doesn't work unless port forwarding. Even when port forwarding I only get a proper response in "localhost:5011/". /auth/login and /auth/SignUp respond with 400 Bad Request.

Also worth noting is that curl by default in powershell is an alias for Invoke-WebRequest. You can remove this alias by running
in powershell. curl will then use the windows variant which is also bad but works.
Anyways the way to access loginService will be through endpoint. When executing the commands listed by Erik in the initial PR inside the entryPoint container everything works well. In order to execute commands in a container you can run
And heres how the response looks from the container:

I noticed that when signing up the same user twice, the service returns an error from what looks like postgres:

It doesn't show any user data but it exposes a constraint in the users table. We should probably introduce some error handling to give an empty http 500 error
Summa summarum
I think if you change the WindowsRebuild to build properly, everything will be fine. It works!! It's just windows thats stupid
@a24noabe the images are not loading, could you take a look at it?
Ran the WindowsRebuild.bat and everything checked out as expected.