docusealco / docuseal

Open source DocuSign alternative. Create, fill, and sign digital documents ✍️
https://www.docuseal.co
GNU Affero General Public License v3.0
6.23k stars 443 forks source link

Error 500 after updating to latest image #293

Closed nascherer closed 3 months ago

nascherer commented 3 months ago

Hello there,

I use the self-hosted docker version of docuseal and until now it worked like a charm for me. just recently updated to version 1.6.0, but when I try to open the webpage, i receive "DocuSeal: [Error] 500 - We're sorry, but somethin went wrong." I run docuseal on an ubuntu vps server. As proxy service i use traefik 2.0 and for database I use postgreSQL. I did not change any settings in my docker-compose.yml. I just stopped the docuseal stack in portainer and the "updated the stack" and hit "re-pull the image" - which leads to pulling the latest image.


 `I, [2024-06-11T21:19:32.869260 #1]  INFO -- : [5addb236-1166-460a-bdfa-f87f97d689d2] {"method":"GET","path":"/","format":"html","controller":"DashboardController","action":"index","status":500,"allocations":17944,"duration":172.7,"view":0.0,"db":15.77,"fwd":"94.31.68.186"}

E, [2024-06-11T21:19:32.876300 #1] ERROR -- : [5addb236-1166-460a-bdfa-f87f97d689d2]   

[5addb236-1166-460a-bdfa-f87f97d689d2] ActionView::Template::Error (ActiveRecord::Encryption::Errors::Decryption):

[5addb236-1166-460a-bdfa-f87f97d689d2]      7: <meta property="og:title" content="<%= title %>">

[5addb236-1166-460a-bdfa-f87f97d689d2]      8: <meta property="og:description" content="<%= description %>">

[5addb236-1166-460a-bdfa-f87f97d689d2]      9: <meta property="og:type" content="website">

[5addb236-1166-460a-bdfa-f87f97d689d2]     10: <meta property="og:url" content="<%= root_url %>">

[5addb236-1166-460a-bdfa-f87f97d689d2]     11: <meta property="og:site_name" content="DocuSeal">

[5addb236-1166-460a-bdfa-f87f97d689d2]     12: <% unless content_for(:disable_image_preview) %>

[5addb236-1166-460a-bdfa-f87f97d689d2]     13:   <meta property="og:image" content="<%= image_pack_url('images/preview.png') %>">

[5addb236-1166-460a-bdfa-f87f97d689d2]   

[5addb236-1166-460a-bdfa-f87f97d689d2] lib/docuseal.rb:78:in `default_url_options'

[5addb236-1166-460a-bdfa-f87f97d689d2] app/controllers/application_controller.rb:40:in `default_url_options'

[5addb236-1166-460a-bdfa-f87f97d689d2] app/views/shared/_meta.html.erb:10

[5addb236-1166-460a-bdfa-f87f97d689d2] app/views/layouts/_head_tags.html.erb:4

[5addb236-1166-460a-bdfa-f87f97d689d2] app/views/layouts/application.html.erb:4

[5addb236-1166-460a-bdfa-f87f97d689d2] app/controllers/dashboard_controller.rb:42:in `maybe_render_landing'

[5addb236-1166-460a-bdfa-f87f97d689d2] lib/api_path_consider_json_middleware.rb:15:in `call'

[5addb236-1166-460a-bdfa-f87f97d689d2] lib/normalize_client_ip_middleware.rb:14:in `call'

I, [2024-06-11T21:19:32.907919 #1]  INFO -- : [5addb236-1166-460a-bdfa-f87f97d689d2] {"method":"GET","path":"/500","format":"html","controller":"ErrorsController","action":"show","status":500,"allocations":2911,"duration":4.58,"view":1.12,"db":0.0,"fwd":"94.31.68.186"}`

This is how my docker-compose.yml for docuseal looks like. at the moment

version: '3.9'
services:
  docuseal:
    container_name: docuseal
    image: docuseal/docuseal:latest
    ports:
      - 3013:3000
    volumes:
      - /home/docker_admin/docker/docuseal/data:/data
    environment:
      - DATABASE_URL=postgresql://MYUSERNAME:MYPASSWORD@postgres:5432/docuseal
    networks:
      - traefik-proxy
    restart: unless-stopped
    labels:
      - "traefik.enable=true"
      - "traefik.http.routers.docuseal.rule=Host(`docuseal.myhomepage.duckdns.org`)"
      - "traefik.http.routers.docuseal.entrypoints=https"
      - "traefik.http.routers.docuseal.tls.certresolver=duckdns"
      - "traefik.http.routers.docuseal.tls=true"

networks:
  traefik-proxy:
    external: true

is it necessary to put a RAILS_MASTER_KEY in the latest version of docuseal?

If i try to log into the postgres database via command line from within the docuseal container

psql -h localhost -U USERNAME -d docuseal

i can reach all the tables ...

Does anyone have an idea?

omohokcoj commented 3 months ago

@nascherer ActiveRecord::Encryption::Errors::Decryption means that your SECRET_KEY_BASE has been changed and table rows can't be decrypted with it now.

Does your /home/docker_admin/docker/docuseal/data folder contain docuseal.env file?

nascherer commented 3 months ago

hi, yes - the file exists, although the path is: /home/docker_admin/docker/docuseal/data/docuseal/

I can't remember having changed or done anything manually here.

DATABASE_URL= # keep empty to use sqlite or specify postgresql database URL 
SECRET_KEY_BASE=SOME-HASHED-VERY-LONG-PASSKEY-I-DONT-KNOW

to keep DATABASE_URL commented out seems logically, since I use postgres from what Password the variable SECRET_KEY_BASE gets hashed I don't have a clue. Of course I have the password for the configured postgres-user...but I guess plain Text will not be accepted?

omohokcoj commented 3 months ago

@nascherer could you please check when the docuseal.env file was created/modified ?

nascherer commented 3 months ago

This file seems to have been automatically created when i last updated the deploy stack in portainer and pulled the latest image. Maybe it was when i restarted the docker service in ubuntu yesterday... don't remember exactly the time


docker_admin@v2202401214983252771:~/docker/docuseal/data/docuseal$ stat ./docuseal.env
  File: ./docuseal.env
  Size: 221             Blocks: 8          IO Block: 4096   regular file
Device: fc03h/64515d    Inode: 1052220     Links: 1
Access: (0755/-rwxr-xr-x)  Uid: ( 1001/docker_admin)   Gid: ( 1001/docker_admin)
Access: 2024-06-12 00:25:23.308720976 +0200
Modify: 2024-06-11 22:25:37.266207478 +0200
Change: 2024-06-11 23:46:28.644106795 +0200
 Birth: 2024-06-11 22:25:37.266207478 +0200
omohokcoj commented 3 months ago

@nascherer unfortunately i'm not sure how portainer updates work - but it seems like your /home/docker_admin/docker/docuseal/data folder was removed and a new one recreated with a new SECRET_KEY_BASE

Now it's not possible to decrypt encrypted configs in your database.

Try to psql into your database and remove all rows from the encrypted_configs table - your app URL, SMTP and storage configs will be removed but you can re-configure everything via the settings UI.

nascherer commented 3 months ago

thanks, this first seemd to have done the trick, but when I tried to log in and put in my credentials, i was asked for 2FA --- but when i put in my code from my 2FA App I again was thrown to the error 500 page.

I tried to reset my password, but there is no email coming -- and even if it would have, don't know if this would have changed anything with the 2FA problem?!

omohokcoj commented 3 months ago

@nascherer your 2FA was also affected by a new SECRET KEY - try to remove 2FA from users table (clear otp_required_for_login and otp_secret columns)

nascherer commented 3 months ago

thank you so much!!!

psql -h postgres -U MYUSERNAME -d docuseal

and than in the database:

UPDATE users SET otp_required_for_login = FALSE, otp_secret = NULL WHERE email = 'myemail@example.com';

finally did it! :-) Highly appreciate your help!

z0lo13 commented 5 days ago

I had the same issue, All steps from above helped besides, i had 500 error when accessing API page. DELETE FROM public.access_tokens; Helped me out