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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upoload image broken in latest docker images and main branch #403

Closed
bigOconstant opened this issue Sep 6, 2021 · 28 comments
Closed

Upoload image broken in latest docker images and main branch #403

bigOconstant opened this issue Sep 6, 2021 · 28 comments
Labels
bug Something isn't working

Comments

@bigOconstant
Copy link

bigOconstant commented Sep 6, 2021

Found a bug? Please fill out the sections below. 馃憤

For backend issues, use lemmy

Issue Summary

Using instructions to run lemmy locally found here with docker-compose the image upload feature does not work and the ui complains about missing jwt and so does the backend of lemmy.

Steps to Reproduce

  1. Follow instructions to run lemmy in docker-compose here
    2.Log in with default lemmy user
  2. Try to upload picture on default community
  3. Notice UI fails with type error failed to fetch and ui logs say,
lemmy-ui_1  | httpbase: https://lemmy:8536
lemmy-ui_1  | wsUri: wss://lemmy:8536/api/v3/ws
lemmy-ui_1  | No JWT cookie found.
lemmy-ui_1  | http://0.0.0.0:1234

Lemmy logs say,

lemmy_1     | thread 'actix-rt|system:0|arbiter:23' panicked at 'No auth header for picture upload', crates/routes/src/images.rs:52:6

Technical details

  • Please post your log: sudo docker-compose logs > lemmy_log.out.
  • What OS are you trying to install lemmy on? Manjaro latest
  • Any browser console errors?

Full log output below,

Attaching to lemmybase_lemmy-ui_1, lemmybase_lemmy_1, lemmybase_pictrs_1, lemmybase_postgres_1
锟絒36mlemmy-ui_1  |锟絒0m Inferno is in development mode.
锟絒36mlemmy-ui_1  |锟絒0m Inferno is in development mode.
锟絒36mlemmy-ui_1  |锟絒0m Inferno is in development mode.
锟絒36mlemmy-ui_1  |锟絒0m httpbase: https://lemmy:8536
锟絒36mlemmy-ui_1  |锟絒0m wsUri: wss://lemmy:8536/api/v3/ws
锟絒36mlemmy-ui_1  |锟絒0m No JWT cookie found.
锟絒36mlemmy-ui_1  |锟絒0m http://0.0.0.0:1234
锟絒36mlemmy-ui_1  |锟絒0m Incorrect JWT token, skipping auth so frontend can remove jwt cookie
锟絒36mlemmy-ui_1  |锟絒0m Incorrect JWT token, skipping auth so frontend can remove jwt cookie
锟絒36mlemmy-ui_1  |锟絒0m Incorrect JWT token, skipping auth so frontend can remove jwt cookie
锟絒36mlemmy-ui_1  |锟絒0m 
锟絒36mlemmy-ui_1  |锟絒0m /app/node_modules/node-fetch/lib/index.js:272
锟絒36mlemmy-ui_1  |锟絒0m 				return Body.Promise.reject(new FetchError(`invalid json response body at ${_this2.url} reason: ${err.message}`, 'invalid-json'));
锟絒36mlemmy-ui_1  |锟絒0m 				                           ^
锟絒36mlemmy-ui_1  |锟絒0m FetchError: invalid json response body at http://lemmy:8536/api/v3/site?auth=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOjIsImlzcyI6Im15X2RvbWFpbiIsImlhdCI6MTYzMDg5NjI4MH0.tJD464bvaT5CylffCEou_9UtzE1OGcRAIFG-xWhztIA reason: Unexpected token N in JSON at position 0
锟絒36mlemmy-ui_1  |锟絒0m     at /app/node_modules/node-fetch/lib/index.js:272:32
锟絒36mlemmy-ui_1  |锟絒0m     at processTicksAndRejections (node:internal/process/task_queues:96:5) {
锟絒36mlemmy-ui_1  |锟絒0m   type: 'invalid-json'
锟絒36mlemmy-ui_1  |锟絒0m }
锟絒36mlemmy-ui_1  |锟絒0m Inferno is in development mode.
锟絒36mlemmy-ui_1  |锟絒0m Inferno is in development mode.
锟絒36mlemmy-ui_1  |锟絒0m Inferno is in development mode.
锟絒36mlemmy-ui_1  |锟絒0m httpbase: https://lemmy:8536
锟絒36mlemmy-ui_1  |锟絒0m wsUri: wss://lemmy:8536/api/v3/ws
锟絒36mlemmy-ui_1  |锟絒0m No JWT cookie found.
锟絒36mlemmy-ui_1  |锟絒0m http://0.0.0.0:1234
锟絒36mlemmy-ui_1  |锟絒0m 
锟絒36mlemmy-ui_1  |锟絒0m /app/node_modules/node-fetch/lib/index.js:272
锟絒36mlemmy-ui_1  |锟絒0m 				return Body.Promise.reject(new FetchError(`invalid json response body at ${_this2.url} reason: ${err.message}`, 'invalid-json'));
锟絒36mlemmy-ui_1  |锟絒0m 				                           ^
锟絒36mlemmy-ui_1  |锟絒0m FetchError: invalid json response body at http://lemmy:8536/api/v3/site?auth=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOjIsImlzcyI6Im15X2RvbWFpbiIsImlhdCI6MTYzMDg5NjI4MH0.tJD464bvaT5CylffCEou_9UtzE1OGcRAIFG-xWhztIA reason: Unexpected token N in JSON at position 0
锟絒36mlemmy-ui_1  |锟絒0m     at /app/node_modules/node-fetch/lib/index.js:272:32
锟絒36mlemmy-ui_1  |锟絒0m     at processTicksAndRejections (node:internal/process/task_queues:96:5) {
锟絒36mlemmy-ui_1  |锟絒0m   type: 'invalid-json'
锟絒36mlemmy-ui_1  |锟絒0m }
锟絒36mlemmy-ui_1  |锟絒0m Inferno is in development mode.
锟絒36mlemmy-ui_1  |锟絒0m Inferno is in development mode.
锟絒36mlemmy-ui_1  |锟絒0m Inferno is in development mode.
锟絒36mlemmy-ui_1  |锟絒0m httpbase: https://lemmy:8536
锟絒36mlemmy-ui_1  |锟絒0m wsUri: wss://lemmy:8536/api/v3/ws
锟絒36mlemmy-ui_1  |锟絒0m No JWT cookie found.
锟絒36mlemmy-ui_1  |锟絒0m http://0.0.0.0:1234
锟絒36mlemmy-ui_1  |锟絒0m 
锟絒36mlemmy-ui_1  |锟絒0m /app/node_modules/node-fetch/lib/index.js:272
锟絒36mlemmy-ui_1  |锟絒0m 				return Body.Promise.reject(new FetchError(`invalid json response body at ${_this2.url} reason: ${err.message}`, 'invalid-json'));
锟絒36mlemmy-ui_1  |锟絒0m 				                           ^
锟絒36mlemmy-ui_1  |锟絒0m FetchError: invalid json response body at http://lemmy:8536/api/v3/site?auth=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOjIsImlzcyI6Im15X2RvbWFpbiIsImlhdCI6MTYzMDg5NjI4MH0.tJD464bvaT5CylffCEou_9UtzE1OGcRAIFG-xWhztIA reason: Unexpected token N in JSON at position 0
锟絒36mlemmy-ui_1  |锟絒0m     at /app/node_modules/node-fetch/lib/index.js:272:32
锟絒36mlemmy-ui_1  |锟絒0m     at processTicksAndRejections (node:internal/process/task_queues:96:5) {
锟絒36mlemmy-ui_1  |锟絒0m   type: 'invalid-json'
锟絒36mlemmy-ui_1  |锟絒0m }
锟絒36mlemmy-ui_1  |锟絒0m Inferno is in development mode.
锟絒36mlemmy-ui_1  |锟絒0m Inferno is in development mode.
锟絒36mlemmy-ui_1  |锟絒0m Inferno is in development mode.
锟絒36mlemmy-ui_1  |锟絒0m httpbase: https://lemmy:8536
锟絒36mlemmy-ui_1  |锟絒0m wsUri: wss://lemmy:8536/api/v3/ws
锟絒36mlemmy-ui_1  |锟絒0m No JWT cookie found.
锟絒36mlemmy-ui_1  |锟絒0m http://0.0.0.0:1234
锟絒33mlemmy_1     |锟絒0m warning: invalid logging spec 'info"', ignoring it
锟絒33mlemmy_1     |锟絒0m [2021-09-06T13:58:51Z INFO  lemmy_server::code_migrations] Running user_updates_2020_04_02
锟絒33mlemmy_1     |锟絒0m [2021-09-06T13:58:51Z INFO  lemmy_server::code_migrations] 0 person rows updated.
锟絒33mlemmy_1     |锟絒0m [2021-09-06T13:58:51Z INFO  lemmy_server::code_migrations] Running community_updates_2020_04_02
锟絒33mlemmy_1     |锟絒0m [2021-09-06T13:58:51Z INFO  lemmy_server::code_migrations] 0 community rows updated.
锟絒33mlemmy_1     |锟絒0m [2021-09-06T13:58:51Z INFO  lemmy_server::code_migrations] Running post_updates_2020_04_03
锟絒33mlemmy_1     |锟絒0m [2021-09-06T13:58:51Z INFO  lemmy_server::code_migrations] 0 post rows updated.
锟絒33mlemmy_1     |锟絒0m [2021-09-06T13:58:51Z INFO  lemmy_server::code_migrations] Running comment_updates_2020_04_03
锟絒33mlemmy_1     |锟絒0m [2021-09-06T13:58:51Z INFO  lemmy_server::code_migrations] 0 comment rows updated.
锟絒33mlemmy_1     |锟絒0m [2021-09-06T13:58:51Z INFO  lemmy_server::code_migrations] Running private_message_updates_2020_05_05
锟絒33mlemmy_1     |锟絒0m [2021-09-06T13:58:51Z INFO  lemmy_server::code_migrations] 0 private message rows updated.
锟絒33mlemmy_1     |锟絒0m [2021-09-06T13:58:51Z INFO  lemmy_server::code_migrations] Running post_thumbnail_url_updates_2020_07_27
锟絒33mlemmy_1     |锟絒0m [2021-09-06T13:58:51Z INFO  lemmy_server::code_migrations] 0 Post thumbnail_url rows updated.
锟絒33mlemmy_1     |锟絒0m [2021-09-06T13:58:51Z INFO  lemmy_server::code_migrations] Running apub_columns_2021_02_02
锟絒33mlemmy_1     |锟絒0m Starting http server at 0.0.0.0:8536
锟絒33mlemmy_1     |锟絒0m [2021-09-06T13:58:51Z INFO  lemmy_server::scheduled_tasks] Updating active site and community aggregates ...
锟絒33mlemmy_1     |锟絒0m [2021-09-06T13:58:51Z INFO  lemmy_server::scheduled_tasks] Done.
锟絒33mlemmy_1     |锟絒0m [2021-09-06T13:58:51Z INFO  lemmy_server::scheduled_tasks] Reindexing table  post_aggregates ...
锟絒33mlemmy_1     |锟絒0m [2021-09-06T13:58:51Z INFO  lemmy_server::scheduled_tasks] Done.
锟絒33mlemmy_1     |锟絒0m [2021-09-06T13:58:51Z INFO  lemmy_server::scheduled_tasks] Reindexing table  comment_aggregates ...
锟絒33mlemmy_1     |锟絒0m [2021-09-06T13:58:51Z INFO  lemmy_server::scheduled_tasks] Done.
锟絒33mlemmy_1     |锟絒0m [2021-09-06T13:58:51Z INFO  lemmy_server::scheduled_tasks] Reindexing table  community_aggregates ...
锟絒33mlemmy_1     |锟絒0m [2021-09-06T13:58:51Z INFO  lemmy_server::scheduled_tasks] Done.
锟絒33mlemmy_1     |锟絒0m [2021-09-06T13:58:51Z INFO  lemmy_server::scheduled_tasks] Clearing old activities...
锟絒33mlemmy_1     |锟絒0m [2021-09-06T13:58:51Z INFO  lemmy_server::scheduled_tasks] Done.
锟絒33mlemmy_1     |锟絒0m [2021-09-06T13:59:25Z INFO  lemmy_api_crud::site::read] Admin lemmy created
锟絒33mlemmy_1     |锟絒0m [2021-09-06T13:59:25Z INFO  lemmy_api_crud::site::read] Site lemmy-test created
锟絒33mlemmy_1     |锟絒0m thread 'actix-rt|system:0|arbiter:12' panicked at 'No auth header for picture upload', crates/routes/src/images.rs:52:6
锟絒33mlemmy_1     |锟絒0m note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
锟絒33mlemmy_1     |锟絒0m [2021-09-06T14:00:00Z INFO  lemmy_server::scheduled_tasks] Updating active site and community aggregates ...
锟絒33mlemmy_1     |锟絒0m [2021-09-06T14:00:00Z INFO  lemmy_server::scheduled_tasks] Done.
锟絒33mlemmy_1     |锟絒0m [2021-09-06T14:00:00Z INFO  lemmy_server::scheduled_tasks] Reindexing table concurrently post_aggregates ...
锟絒33mlemmy_1     |锟絒0m [2021-09-06T14:00:00Z INFO  lemmy_server::scheduled_tasks] Done.
锟絒33mlemmy_1     |锟絒0m [2021-09-06T14:00:00Z INFO  lemmy_server::scheduled_tasks] Reindexing table concurrently comment_aggregates ...
锟絒33mlemmy_1     |锟絒0m [2021-09-06T14:00:00Z INFO  lemmy_server::scheduled_tasks] Done.
锟絒33mlemmy_1     |锟絒0m [2021-09-06T14:00:00Z INFO  lemmy_server::scheduled_tasks] Reindexing table concurrently community_aggregates ...
锟絒33mlemmy_1     |锟絒0m [2021-09-06T14:00:00Z INFO  lemmy_server::scheduled_tasks] Done.
锟絒33mlemmy_1     |锟絒0m thread 'actix-rt|system:0|arbiter:14' panicked at 'No auth header for picture upload', crates/routes/src/images.rs:52:6
锟絒33mlemmy_1     |锟絒0m thread 'actix-rt|system:0|arbiter:16' panicked at 'No auth header for picture upload', crates/routes/src/images.rs:52:6
锟絒33mlemmy_1     |锟絒0m thread 'actix-rt|system:0|arbiter:17' panicked at 'No auth header for picture upload', crates/routes/src/images.rs:52:6
锟絒33mlemmy_1     |锟絒0m thread 'actix-rt|system:0|arbiter:23' panicked at 'No auth header for picture upload', crates/routes/src/images.rs:52:6
锟絒35mpostgres_1  |锟絒0m The files belonging to this database system will be owned by user "postgres".
锟絒35mpostgres_1  |锟絒0m This user must also own the server process.
锟絒35mpostgres_1  |锟絒0m 
锟絒35mpostgres_1  |锟絒0m The database cluster will be initialized with locale "en_US.utf8".
锟絒35mpostgres_1  |锟絒0m The default database encoding has accordingly been set to "UTF8".
锟絒35mpostgres_1  |锟絒0m The default text search configuration will be set to "english".
锟絒35mpostgres_1  |锟絒0m 
锟絒35mpostgres_1  |锟絒0m Data page checksums are disabled.
锟絒35mpostgres_1  |锟絒0m 
锟絒35mpostgres_1  |锟絒0m fixing permissions on existing directory /var/lib/postgresql/data ... ok
锟絒35mpostgres_1  |锟絒0m creating subdirectories ... ok
锟絒35mpostgres_1  |锟絒0m selecting dynamic shared memory implementation ... posix
锟絒35mpostgres_1  |锟絒0m selecting default max_connections ... 100
锟絒35mpostgres_1  |锟絒0m selecting default shared_buffers ... 128MB
锟絒35mpostgres_1  |锟絒0m selecting default time zone ... UTC
锟絒35mpostgres_1  |锟絒0m creating configuration files ... ok
锟絒35mpostgres_1  |锟絒0m running bootstrap script ... ok
锟絒35mpostgres_1  |锟絒0m sh: locale: not found
锟絒35mpostgres_1  |锟絒0m 2021-09-06 13:58:48.980 UTC [31] WARNING:  no usable system locales were found
锟絒35mpostgres_1  |锟絒0m performing post-bootstrap initialization ... ok
锟絒35mpostgres_1  |锟絒0m initdb: warning: enabling "trust" authentication for local connections
锟絒35mpostgres_1  |锟絒0m syncing data to disk ... ok
锟絒35mpostgres_1  |锟絒0m 
锟絒35mpostgres_1  |锟絒0m 
锟絒35mpostgres_1  |锟絒0m Success. You can now start the database server using:
锟絒35mpostgres_1  |锟絒0m 
锟絒35mpostgres_1  |锟絒0m     pg_ctl -D /var/lib/postgresql/data -l logfile start
锟絒35mpostgres_1  |锟絒0m 
锟絒35mpostgres_1  |锟絒0m You can change this by editing pg_hba.conf or using the option -A, or
锟絒35mpostgres_1  |锟絒0m --auth-local and --auth-host, the next time you run initdb.
锟絒35mpostgres_1  |锟絒0m waiting for server to start....2021-09-06 13:58:49.306 UTC [36] LOG:  starting PostgreSQL 12.8 on x86_64-pc-linux-musl, compiled by gcc (Alpine 10.3.1_git20210424) 10.3.1 20210424, 64-bit
锟絒35mpostgres_1  |锟絒0m 2021-09-06 13:58:49.307 UTC [36] LOG:  listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
锟絒35mpostgres_1  |锟絒0m 2021-09-06 13:58:49.320 UTC [37] LOG:  database system was shut down at 2021-09-06 13:58:49 UTC
锟絒35mpostgres_1  |锟絒0m 2021-09-06 13:58:49.323 UTC [36] LOG:  database system is ready to accept connections
锟絒35mpostgres_1  |锟絒0m  done
锟絒35mpostgres_1  |锟絒0m server started
锟絒35mpostgres_1  |锟絒0m CREATE DATABASE
锟絒35mpostgres_1  |锟絒0m 
锟絒35mpostgres_1  |锟絒0m 
锟絒35mpostgres_1  |锟絒0m /usr/local/bin/docker-entrypoint.sh: ignoring /docker-entrypoint-initdb.d/*
锟絒35mpostgres_1  |锟絒0m 
锟絒35mpostgres_1  |锟絒0m waiting for server to shut down...2021-09-06 13:58:49.501 UTC [36] LOG:  received fast shutdown request
锟絒35mpostgres_1  |锟絒0m .2021-09-06 13:58:49.502 UTC [36] LOG:  aborting any active transactions
锟絒35mpostgres_1  |锟絒0m 2021-09-06 13:58:49.502 UTC [36] LOG:  background worker "logical replication launcher" (PID 43) exited with exit code 1
锟絒35mpostgres_1  |锟絒0m 2021-09-06 13:58:49.503 UTC [38] LOG:  shutting down
锟絒35mpostgres_1  |锟絒0m 2021-09-06 13:58:49.516 UTC [36] LOG:  database system is shut down
锟絒35mpostgres_1  |锟絒0m  done
锟絒35mpostgres_1  |锟絒0m server stopped
锟絒35mpostgres_1  |锟絒0m 
锟絒35mpostgres_1  |锟絒0m PostgreSQL init process complete; ready for start up.
锟絒35mpostgres_1  |锟絒0m 
锟絒35mpostgres_1  |锟絒0m 2021-09-06 13:58:49.611 UTC [1] LOG:  starting PostgreSQL 12.8 on x86_64-pc-linux-musl, compiled by gcc (Alpine 10.3.1_git20210424) 10.3.1 20210424, 64-bit
锟絒35mpostgres_1  |锟絒0m 2021-09-06 13:58:49.611 UTC [1] LOG:  listening on IPv4 address "0.0.0.0", port 5432
锟絒35mpostgres_1  |锟絒0m 2021-09-06 13:58:49.611 UTC [1] LOG:  listening on IPv6 address "::", port 5432
锟絒35mpostgres_1  |锟絒0m 2021-09-06 13:58:49.613 UTC [1] LOG:  listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
锟絒35mpostgres_1  |锟絒0m 2021-09-06 13:58:49.624 UTC [50] LOG:  database system was shut down at 2021-09-06 13:58:49 UTC
锟絒35mpostgres_1  |锟絒0m 2021-09-06 13:58:49.628 UTC [1] LOG:  database system is ready to accept connections
锟絒32mpictrs_1    |锟絒0m 锟絒2mSep 06 13:58:48.619锟絒0m 锟絒32m INFO锟絒0m actix_server::builder: Starting 24 workers    
锟絒32mpictrs_1    |锟絒0m 锟絒2mSep 06 13:58:48.620锟絒0m 锟絒32m INFO锟絒0m actix_server::builder: Starting "actix-web-service-0.0.0.0:8080" service on 0.0.0.0:8080    

@bigOconstant bigOconstant added the bug Something isn't working label Sep 6, 2021
@dessalines
Copy link
Member

锟絒36mlemmy-ui_1  |锟絒0m No JWT cookie found.
锟絒36mlemmy-ui_1  |锟絒0m http://0.0.0.0:1234
锟絒36mlemmy-ui_1  |锟絒0m Incorrect JWT token, skipping auth so frontend can remove jwt cookie
锟絒36mlemmy-ui_1  |锟絒0m Incorrect JWT token, skipping auth so frontend can remove jwt cookie
锟絒36mlemmy-ui_1  |锟絒0m Incorrect JWT token, skipping auth so frontend can remove jwt cookie

Clear your browser cookies for that site. And make sure you don't have browser plugin that might be blocking cookies.

Also make sure you're on 0.12.1 .

@bigOconstant
Copy link
Author

bigOconstant commented Sep 6, 2021

锟絒36mlemmy-ui_1  |锟絒0m No JWT cookie found.
锟絒36mlemmy-ui_1  |锟絒0m http://0.0.0.0:1234
锟絒36mlemmy-ui_1  |锟絒0m Incorrect JWT token, skipping auth so frontend can remove jwt cookie
锟絒36mlemmy-ui_1  |锟絒0m Incorrect JWT token, skipping auth so frontend can remove jwt cookie
锟絒36mlemmy-ui_1  |锟絒0m Incorrect JWT token, skipping auth so frontend can remove jwt cookie

Clear your browser cookies for that site. And make sure you don't have browser plugin that might be blocking cookies.

Also make sure you're on 0.12.1 .

changed docker-compose from

dessalines/lemmy-ui:0.12.0 to dessalines/lemmy-ui:0.12.1

and dessalines/lemmy:0.12.0 to dessalines/lemmy:0.12.1

Opened a private browser session in firefox with no plugins and I still get the same thing.

@dessalines
Copy link
Member

You need to have a running nginx for pictures to work at the moment, you do have that set up?

If you're accessing lemmy via :1234 picture uploads won't work.

@bigOconstant
Copy link
Author

You need to have a running nginx for pictures to work at the moment, you do have that set up?

If you're accessing lemmy via :1234 picture uploads won't work.

Ah ok, no I didn't set up nginx. I think that should be more clear in the docs though. Why is it that we need nginx to upload pictures?

@dessalines
Copy link
Member

We used to require nginx for routing to iframely and pictrs. Now we removed iframely, and we route pictrs requests through lemmy, but we still have to add it to our official API. Once we do this nginx will no longer be necessary for pictures.

In reality it has to do with cross-domain issues... the UI runs on :1234 but the back end is at :8536. Browsers don't mind cross port websocket, but cross-port HTTP is forbidden. You might be able to try one of those access-control-allow / CORS plugins for FF, that might fix it without nginx for now.

@bigOconstant
Copy link
Author

We used to require nginx for routing to iframely and pictrs. Now we removed iframely, and we route pictrs requests through lemmy, but we still have to add it to our official API. Once we do this nginx will no longer be necessary for pictures.

In reality it has to do with cross-domain issues... the UI runs on :1234 but the back end is at :8536. Browsers don't mind cross port websocket, but cross-port HTTP is forbidden. You might be able to try one of those access-control-allow / CORS plugins for FF, that might fix it without nginx for now.

interesting. Is most of the api calls going through websockets? I don't see many entries in my network tab. tbh I've never actually used websockets before. So most stuff works because it's going through a websocket, but http request are failing because of cors?

I tried a disable cors addon with no luck. @dessalines would you happen to know how the ui builds the backend url? I'm having a hard time trying to set it. I'm trying to get a reverse proxy with nginx set up but its stuck building it as localhost:8536 when I want it to point to my reverse proxy url.

@dessalines
Copy link
Member

Use this: https://github.com/LemmyNet/lemmy/blob/main/ansible/templates/nginx.conf

And edit the vars in the {{ }} as indicated. This all should be in the docker install instructions.

@ghost
Copy link

ghost commented Sep 7, 2021

I'm also having this issue on my test instance I set up recently. Its giving me "No JWT cookie found" in lemmy-ui logs. Please let me know if a solution to this is found.

@dessalines
Copy link
Member

@ThePurpleRabbit and you are also running nginx? I believe this is explicitly in the docs: https://join-lemmy.org/docs/en/administration/install_docker.html

@harcesz
Copy link

harcesz commented Sep 7, 2021

seems we run into the same problem over ansible install, earlier images dont show either

@rysiekpl
Copy link

rysiekpl commented Sep 7, 2021

seems we run into the same problem over ansible install, earlier images dont show either

Can confirm. Example here: https://szmer.info/pictrs/image/gwCBW64PfY.jpg?format=webp&thumbnail=96
in a clean browser, not logged in, the result is just the text: images_disabled. Nothing in docker-compose logs -f output.

Non-processed images also fail: https://szmer.info/pictrs/image/gwCBW64PfY.jpg

Uploading images is also broken, uploading an image fails with message in the browser window:

SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON data

This instance was running 0.11.3, we upgraded tonight to 0.12.2. No changes in secrets (JWT token in lemmy.hjson, PostgreSQL passwords in docker-compose.yml and lemmy.hjson) - we keep those in local git repositories, so we know if changes happen and when.

The instance was deployed using the Ansible playbook from the official repo, and is using NginX configured by that playbook.

@dessalines
Copy link
Member

@rysiekpl That's a different issue, because you didn't follow the upgrade notes.

@rysiekpl
Copy link

rysiekpl commented Sep 7, 2021

@rysiekpl That's a different issue, because you didn't follow the upgrade notes.

Do you think maybe it would make sense to add that line to the config.hjson in ansible/templates? It's not there: https://github.com/LemmyNet/lemmy/blob/main/ansible/templates/config.hjson

@dessalines
Copy link
Member

Oops, our bad, thx for catching. I'll add that now.

@ghost
Copy link

ghost commented Sep 8, 2021

I was able to fix this issue by adding

pictrs_url: "http://pictrs:8080"

To the lemmy.hjson file

@dessalines
Copy link
Member

Post your nginx, docker-compose.yml, and lemmy.hjson files. I don't know where the issue is without those.

@bigOconstant
Copy link
Author

I am closing this issue because image upload works in docker now because it is configured to go through nginx by default. Instead of going to localhost;1235 go to 0.0.0.0:1236

@Mawlz
Copy link

Mawlz commented Dec 6, 2021

I am having the same issue, as requrested by @dessalines below is the log from the server:

https://pastebin.com/fqyQPjKz

What could the issue be?

Additionally, I have also installed NGINX the app is running on Apache and NGINX for testing purposes:

Apache: https://mawlz.com/
NGINX: https://mawlz.com:8443/

As you can see on both of the web servers it is not working

@dessalines
Copy link
Member

@Mawlz Post your nginx, docker-compose.yml, and lemmy.hjson files. I don't know where the issue is without those.

@Mawlz
Copy link

Mawlz commented Dec 7, 2021

@dessalines
Copy link
Member

dessalines commented Dec 8, 2021

set $proxpass "http://0.0.0.0:1236";

Should be 1235

1236 is only for our dev setups, run in the docker/dev folder, not for deploys.

@Mawlz
Copy link

Mawlz commented Dec 8, 2021

@dessalines

I only changed it to 1236 per the above fix when the issue was closed.

I have now reverted back to 1235

Apache: https://mawlz.com/
NGINX: https://mawlz.com:8443/

The issue persists.

I have changed nothing else

@dessalines
Copy link
Member

@Mawlz

mkdir -p volumes/pictrs
sudo chown -R 991:991 volumes/pictrs
sudo docker-compose restart pictrs

@Mawlz
Copy link

Mawlz commented Dec 9, 2021

@dessalines

Yes, this has already been made and it is one of the first steps inside the documentation we followed:

https://join-lemmy.org/docs/en/administration/install_docker.html

I have executed the commands again without the mkdir since the directories are created and there is some content inside of them:

[root@vm2248 [/home/mawlz/lemmy]]# ll
total 8
-rw-r--r-- 1 root root 1195 Dec 3 09:00 docker-compose.yml
-rw-r--r-- 1 root root 1741 Dec 3 08:59 lemmy.hjson
drwxr-xr-x 4 root root 36 Dec 1 17:34 volumes
[root@vm2248 [/home/mawlz/lemmy]]# sudo chown -R 991:991 volumes/pictrs
[root@vm2248 [/home/mawlz/lemmy]]# sudo docker-compose restart pictrs
Restarting lemmy_pictrs_1 ... done
[root@vm2248 [/home/mawlz/lemmy]]# cd volumes/
[root@vm2248 [/home/mawlz/lemmy/volumes]]# ll
total 4
drwxrwxrwx 4 sssd cpanelphppgadmin 31 Dec 1 17:34 pictrs
drwx------ 19 70 root 4096 Dec 1 17:42 postgres
c[root@vm2248 [/home/mawlz/lemmy/volumes]]# cd pictrs/
[root@vm2248 [/home/mawlz/lemmy/volumes/pictrs]]# ll
total 0
drwxrwxrwx 2 sssd cpanelphppgadmin 6 Dec 1 17:34 files
drwxrwxrwx 3 sssd cpanelphppgadmin 21 Dec 1 17:34 sled

What exactly is the UID:GUID 991 since for cPanel servers it seems this is SSSD and cpanel's PHPPostGreAdmin.

If this should be a special user which may be different on your system we can assign it, but 991 is what appears on the ll, for me this step was extremely strange.

@bigOconstant
Copy link
Author

Pictrs is run as a non root container. Which is best practice. I assume that number is the id assigned to the user in the pictrs container

@dessalines
Copy link
Member

It also says 404 not found to https://mawlz.com/pictrs/image , which tells me you didn't set up your nginx properly.

@Mawlz
Copy link

Mawlz commented Dec 10, 2021

@dessalines

@bigOconstant

I'm not sure this is correct as my system is CentOS 7 with Cpanel and all docker containers are ran by docker who is on the root user, docker containers work in their own environment and the fact that the configuration files are owned by root is not a problem since docker is installed and used by the root user.

As for the directories for pictrs they are owned by 991 which is the user specified in the tutorial, all other directories may be owned by root.

The pictrs/image is giving error 405 which is not 404:

https://mawlz.com:8443/pictrs/image

The correct URL for the NGINX build is with port 8443 on the back. Dessalines I believe you clicked the wrong URL above when you commented it showed 404.

I have changed the UID and GID to mawlz and reran docker, and again the app is not working.

Dessalines, would you by any chance log on to the server and review where this is going wrong?

I can provide the details via a private message on lemmy.ml if you agree

Thanks in advance

@dessalines
Copy link
Member

I don't have time to do that, but also lemmy won't work at a non-standard port like that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants