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

Hosts of a deleted user break the host lists #1038

Closed
aab12345 opened this issue Apr 24, 2021 · 13 comments
Closed

Hosts of a deleted user break the host lists #1038

aab12345 opened this issue Apr 24, 2021 · 13 comments
Labels

Comments

@aab12345
Copy link

aab12345 commented Apr 24, 2021

This error message happens when deleting a user which created hosts.
"Cannot read property 'avatar' of null"

Are you in the right place? - I hope so, if not sorry.

  • If you are looking for support on how to get your upstream server forwarding, please consider asking the community on Reddit.

  • If you are writing code changes to contribute and need to ask about the internals of the software, Gitter is the best place to ask.

  • If you think you found a bug with NPM (not Nginx, or your upstream server or MySql) then you are in the right place.

Checklist

  • Have you pulled and found the error with jc21/nginx-proxy-manager:latest docker image? - No
  • Are you sure you're not using someone else's docker image? - Yes
  • If having problems with Lets Encrypt, have you made absolutely sure your site is accessible from outside of your network? - No

Describe the bug

  • Cannot read property 'avatar' of null when deleting a user and going back to created hosts
  • What version of Nginx Proxy Manager is reported on the login page? - v2.8.1

To Reproduce
Steps to reproduce the behavior:

  • Create a new user
  • Create a new redirection host
  • Delete user
  • End up seeing "Cannot read property 'avatar' of null" where new redirection host should be

Expected behavior
Got error when deleting user to a created redirection host, not sure what I should be seeing but it's broken I think.

Screenshots
Screenshots attached.
Capture

Operating System

  • Ubuntu 20.10

Additional context
Docker Engine - 20.10.6

@aab12345 aab12345 added the bug label Apr 24, 2021
@aab12345
Copy link
Author

aab12345 commented Apr 24, 2021

looks like I fixed it by doing the following;

Installed DB Browser SQLite (Windows)
Going to /srv/dev-disk-by-label-Files/Config/Nginx-Proxy
Open the database.sqlite with DB Browser SQLite
Browsing the Data > Table user
Modifying Is_Deleted=0
Go to > redirection host table > delete line 1 > Save
Then file > write changes > Stopped the container
Copied over edited database back to /srv/dev-disk-by-label-Files/Config/Nginx-Proxy
Restarted the service > Bingo!

No more error and the users are back. I couldn't find how to connect to the sql via docker but this way seemed to work so not sure if this is still a bug when deleting a user. Still might need looking into though but this above works.

@aab12345
Copy link
Author

Issue closed because I feel like it's resolved with the above fix after further testing. If I have done it wrong or there may be another way for future reference please comment here.

Thanks for the NPM, love it!

@MichelBaie
Copy link

I think you should reopen this issue because it need to be fixed by the developpers. I've did the same error as deleting users with existing hosts.

@chaptergy chaptergy changed the title Cannot read property 'avatar' of null Hosts of a deleted user break the host lists Aug 11, 2021
@chaptergy chaptergy reopened this Aug 11, 2021
@MichelBaie
Copy link

Thanks @chaptergy 👍

@jc21
Copy link
Member

jc21 commented Aug 11, 2021

Some technical notes on this:

The user record is only soft-deleted, is_deleted = true and any other object still referring to a soft-deleted object was still meant to be loaded by the Objection library, but this case has undoubtedly slipped through.

It should hopefully be as easy as ensuring there isn't a check for is_deleted = false in the query that joins the users for these objects.

The idea of soft deletion is so you can see whom created those objects even after they are dead to you.

@okworx
Copy link

okworx commented Dec 30, 2021

I think this should be reopened as indeed this is a bug, even though some sort of workaround exists.

@sdotb
Copy link

sdotb commented Mar 3, 2022

+1 to me, still facing the bug in proxy_hosts also, is there a way to reassign ownership?

@v3ss0n
Copy link

v3ss0n commented May 5, 2022

This stupid bug still exist and making us unable to change anything. Deleting one user effects all , very bad design , please look into it.

@franciscopaniskaseker
Copy link

Happened with me today. Still bugged.

@aab12345
Copy link
Author

aab12345 commented Dec 1, 2022

I didn't reopen it because I decided not to use it any more. It was a pretty series bug that caused me no end of problems. I'm shocked this hasn't been fixed by now.

@abosaad11
Copy link

looks like I fixed it by doing the following;

Installed DB Browser SQLite (Windows) Going to /srv/dev-disk-by-label-Files/Config/Nginx-Proxy Open the database.sqlite with DB Browser SQLite Browsing the Data > Table user Modifying Is_Deleted=0 Go to > redirection host table > delete line 1 > Save Then file > write changes > Stopped the container Copied over edited database back to /srv/dev-disk-by-label-Files/Config/Nginx-Proxy Restarted the service > Bingo!

No more error and the users are back. I couldn't find how to connect to the sql via docker but this way seemed to work so not sure if this is still a bug when deleting a user. Still might need looking into though but this above works.

This happened to me today. You saved me thanks a million.

@mashb1t
Copy link

mashb1t commented Aug 1, 2023

the same error happened to me today. Solved by following the instructions here: #230 (comment)

@jc21 is this bug on the agenda for the near future?
We now disabled the administrator default user, but can't soft delete it due to the bug. Is there a better solution than disabling it?

@adelpro
Copy link

adelpro commented Oct 9, 2024

The issue started when i reset the user using these command:
docker exec -it sh

apt update && apt install sqlite3 -y

sqlite3 /data/database.sqlite

sqlite> UPDATE user SET is_deleted=1;
sqlite> .exit

exit

Then after login using the default email/password; i returned to the command line and run:
docker exec -it sh

sqlite3 /data/database.sqlite

sqlite> UPDATE user SET is_deleted=0;
sqlite> .exit

exit

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

No branches or pull requests