inoda / journal

:notebook: A simple self-hosted journaling app
MIT License
361 stars 52 forks source link

Sharing posts: ERR 500 #35

Closed jtagcat closed 2 years ago

jtagcat commented 2 years ago

Sharing a post, either public or private results in 500.

I, [2022-01-14T03:41:51.882733 #1]  INFO -- : [f230c88b-5da6-4ef3-878f-e468e6a9e47c] Started PUT "/posts/1/share?public=true" for 172.31.0.1 at 2022-01-14 03:41:51 +0000
I, [2022-01-14T03:41:51.883965 #1]  INFO -- : [f230c88b-5da6-4ef3-878f-e468e6a9e47c] Processing by PostsController#share as HTML
I, [2022-01-14T03:41:51.884068 #1]  INFO -- : [f230c88b-5da6-4ef3-878f-e468e6a9e47c]   Parameters: {"authenticity_token"=>"redactedcGiA==", "public"=>"true", "id"=>"1"}
D, [2022-01-14T03:41:51.887228 #1] DEBUG -- : [f230c88b-5da6-4ef3-878f-e468e6a9e47c]   Post Load (0.6ms)  SELECT "posts".* FROM "posts" WHERE "posts"."id" = $1 LIMIT $2  [["id", 1], ["LIMIT", 1]]
I, [2022-01-14T03:41:51.889193 #1]  INFO -- : [f230c88b-5da6-4ef3-878f-e468e6a9e47c] Completed 500 Internal Server Error in 5ms (ActiveRecord: 0.6ms | Allocations: 906)
F, [2022-01-14T03:41:51.889877 #1] FATAL -- : [f230c88b-5da6-4ef3-878f-e468e6a9e47c]
[f230c88b-5da6-4ef3-878f-e468e6a9e47c] NoMethodError (undefined method `unpack1' for nil:NilClass):
[f230c88b-5da6-4ef3-878f-e468e6a9e47c]
[f230c88b-5da6-4ef3-878f-e468e6a9e47c] app/models/post.rb:24:in `encrypted_sharing_token'
[f230c88b-5da6-4ef3-878f-e468e6a9e47c] app/managers/post_manager.rb:15:in `block in share'
[f230c88b-5da6-4ef3-878f-e468e6a9e47c] app/managers/post_manager.rb:13:in `loop'
[f230c88b-5da6-4ef3-878f-e468e6a9e47c] app/managers/post_manager.rb:13:in `share'
[f230c88b-5da6-4ef3-878f-e468e6a9e47c] app/controllers/posts_controller.rb:68:in `share'
inoda commented 2 years ago

@jtagcat You need to set the SHARING_TOKEN_CIPHER_IV ENV var (there are instructions in the readme on how to do this)

jtagcat commented 2 years ago

Ah, I had a typo, thanks!

image