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

Unable to delete things. #321

Open
mortimus1987 opened this issue Nov 6, 2024 · 15 comments
Open

Unable to delete things. #321

mortimus1987 opened this issue Nov 6, 2024 · 15 comments

Comments

@mortimus1987
Copy link

I have uploaded a brief test track, to check the import functionality from my phone. Having it confirmed it worked, I attempted to delete the workout but received the following error:

Something went wrong: ERROR: update or delete on table "map_data" violates foreign key constraint "fk_map_data_details" on table "map_data_details" (SQLSTATE 23503)

I get the a similar error when attempting to delete the initial admin user (after creating another user and ensuring they have admin privileges) but for "fk_users_profile" on table "profiles".

I am using a docker compose deployment with PostGres 16 alpine as the database.

@jovandeginste
Copy link
Owner

Can you check the exact version you are running?

@mortimus1987
Copy link
Author

mortimus1987 commented Nov 6, 2024

The docker image is the :latest tag. Workout tracker itself reports "branch master (c6d4ea0)"

jovandeginste added a commit that referenced this issue Nov 8, 2024
Pass user validation as a middleware instead of a SuccessFunc. Add
redirect to signout endpoint if user is not found. Add error logging for
failed user validation.

Ref: #321

Signed-off-by: Jo Vandeginste <[email protected]>
@jovandeginste
Copy link
Owner

Would you be able to reproduce this with sqlite as the database engine?

@mortimus1987
Copy link
Author

No; using sqlite I seem to be able to delete both workouts and users with no issue, so that suggests its PostGres related.

Interestingly, initially the docker container kept crashing when I tried to use sqlite instead of PG. After checking the logs I realised this was because my JWT environment variable was a mess with brackets and spaces etc. (failure of variable substitution by ansible when I deployed the compose stack because of my fat fingers). I don't know if thats expected or not, but using the exact same env var the container started fine when using postgres.

Just to be clear, I corrected the JWT var and made a new PG database, and the inability to delete persists, so its not related, but thought it worth mentioning in case its also unintentional behaviour.

@jovandeginste
Copy link
Owner

Then I will need to test with a postgres backend

@jovandeginste
Copy link
Owner

Can you check the latest master image?

@mortimus1987
Copy link
Author

Using the latest docker container (6d65746) and I have been able to delete the administrator user successfully. However, attempting to delete the workout I uploaded as a test still fails with the same error.

@jovandeginste
Copy link
Owner

Using the latest docker container (6d65746) and I have been able to delete the administrator user successfully. However, attempting to delete the workout I uploaded as a test still fails with the same error.

Was this a new test, or the previous database content?

@sikmir
Copy link
Contributor

sikmir commented Nov 26, 2024

I have the same problem:

Something went wrong: ERROR: update or delete on table "map_data" violates foreign key constraint "fk_map_data_details" on table "map_data_details"

@jovandeginste
Copy link
Owner

Can you make sure to use the latest image (from commit e55abb5)?

@sikmir
Copy link
Contributor

sikmir commented Nov 26, 2024

Can you make sure to use the latest image (from commit e55abb5)?

Yes, I use the latest one with postgresql backend.

@jovandeginste
Copy link
Owner

Could you find a way to reproduce? I tried here but to no avail...

@sikmir
Copy link
Contributor

sikmir commented Nov 27, 2024

Could you find a way to reproduce? I tried here but to no avail...

It's easy to reproduce, since it happens each time I try to delete a workout. What additional info can help here?

@jovandeginste
Copy link
Owner

Can you reproduce from an empty setup? Because I can not reproduce from scratch.

@sikmir
Copy link
Contributor

sikmir commented Nov 27, 2024

Can you reproduce from an empty setup? Because I can not reproduce from scratch.

It is new setup, I've deployed it to the server and just added some tracks.

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

3 participants