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 File Push #794

Closed
DecisionIT opened this issue Feb 6, 2023 · 38 comments
Closed

Unable to File Push #794

DecisionIT opened this issue Feb 6, 2023 · 38 comments
Labels

Comments

@DecisionIT
Copy link

Checklist

  • [ x] I've searched the project's issues.
  • [x ] I've searched the project's discussions.

❓ Question

We just enabled File Push in our self-hosted Password Pusher, but we can't push files.

We have pwpush setup in a Docker container and have used the password function for quite a while with no issue. I tried enabling the file push option using local storage. I can see the files being uploaded to the server, but I am running into the following issues.

  • Links do not generate unless "Use 1-Click retrieval step" and "Allow immediate deletion" is unchecked. It just sits there saying 'pushing'
  • Links to uploaded files do not work and just say they are expired.

📎 Additional context

We are using the following containers to run pwpush:

nginx:latest
postgres:10
pglombardo/pwpush-postgres:release

The following options are set in the docker-compose file for the File Push.

  PWP__ENABLE_FILE_PUSHES: "true"
  PWP__FILES__STORAGE: "local"
  PWP__FILES__EXPIRE_AFTER_DAYS_MAX: "7"
  PWP__FILES__EXPIRE_AFTER_VIEWS_MAX: "3"
  PWP__FILES__RETRIEVAL_STEP_DEFAULT: "true"
volumes:
  - /home/ubuntu/pwpush/storage:/opt/PasswordPusher/storage:rw

I can share a sanitized version of the docker-compose if needed.

@github-actions
Copy link

github-actions bot commented Feb 6, 2023

Hello @DecisionIT, thanks for contributing to the Password Pusher community! We will respond as soon as possible.

@pglombardo
Copy link
Owner

Hi @DecisionIT - apologies for the issue. I just updated the release tag to the latest.

To diagnose, can you re-pull that tag and retest?

If still not working, can you shell into the container and create a file on that volume without issue?

For example:

docker exec -it <container ID> /bin/bash
cat "blah" > /opt/PasswordPusher/storage/test.txt

And lastly, application logs may help. They are in the container at /opt/PasswordPusher/log/*.log

@pglombardo
Copy link
Owner

Also a good test might to try the request directly to the container (without nginx). The file uploads do some back and forth that nginx might not be handling correctly.

Creating a file push directly with the Password Pusher container will tell us if nginx is the issue.

@DecisionIT
Copy link
Author

Hi @pglombardo,

Here are the results of the testing.

  • Changing the tag to "latest" did not work, still having the same issue.
  • removing nginx and accessing pwpush direct still produces the same issue
  • When I upload a file in pwpush, I can see the file being created in the storage volume on the server
  • I can create a the file from within the container

There was only one log file in the /opt/PasswordPusher/log/*.log folder. The contents of the log is below. This was after a few attempts at doing a file push.

production.log

F, [2023-02-07T14:35:45.721779 #345] FATAL -- : [fe0c965a-d905-4008-abdf-223eefdece7c]
[fe0c965a-d905-4008-abdf-223eefdece7c] ActionController::RoutingError (No route matches [GET] "/da/brugere/bekr%C3%A6ftelse/en"):
[fe0c965a-d905-4008-abdf-223eefdece7c]
F, [2023-02-07T14:35:51.358165 #346] FATAL -- : [2e8acb63-5d66-45f5-99f8-81e9b2f101d7]
[2e8acb63-5d66-45f5-99f8-81e9b2f101d7] ActionController::RoutingError (No route matches [GET] "/de/Benutzer/best%C3%A4tigen/da"):
[2e8acb63-5d66-45f5-99f8-81e9b2f101d7]
F, [2023-02-07T14:35:54.902027 #346] FATAL -- : [bd8bd37c-d9d9-4338-9d0f-9979858c5a1c]
[bd8bd37c-d9d9-4338-9d0f-9979858c5a1c] ActionController::RoutingError (No route matches [GET] "/nl/gebruikers/wachtwoord/fi"):
[bd8bd37c-d9d9-4338-9d0f-9979858c5a1c]
F, [2023-02-07T14:35:57.794194 #346] FATAL -- : [34d65e3d-d9a3-4eb5-b96b-8bbcc8e7cd09]
[34d65e3d-d9a3-4eb5-b96b-8bbcc8e7cd09] ActionController::RoutingError (No route matches [GET] "/sv/anvandare/las_upp/de"):
[34d65e3d-d9a3-4eb5-b96b-8bbcc8e7cd09]

@pglombardo
Copy link
Owner

Hrm then possibly the browser might tell us something. Is there anything in the javascript console of the browser?

Try another browser, private mode etc...

Links do not generate unless "Use 1-Click retrieval step" and "Allow immediate deletion" is unchecked. It just sits there saying 'pushing'

If checked it works?

If still nothing, maybe you could provide a docker compose file of your setup with env vars/settings (that you can share) and I can try to recreate the issue here locally.

@DecisionIT
Copy link
Author

So, no matter what options we have set, we are never able to actually view the file that was pushed. If it generates a link and you use it, it will say that it is expired. If, when pushing the file, the page just sits on 'pushing', you can see the link in the Audit Log, but if you go to it, it says that it is expired.

For Edge and Chrome:
When the page is stuck on 'pushing' i see the below in the console
Failed to load resource: the server responded with a status of 403 (Forbidden)
Sometimes in Edge and Chrome, the links get generated and doesn't get stuck on 'pushing', both with and without the 1-click and allow immediate deletion checked.

For Firefox,
I have not experienced it get stuck on 'pushing', but the links still do not work.

For Safari
get the same Failed to load resource: the server responded with a status of 403 (Forbidden) error when it gets stuck on 'pushing'

I also see these messages in Edge\Chrome after navigating around the site
image

the docker-compose file

version: '3.0'

services:
  nginx:
    container_name: pwpush_nginx
    image: nginx:latest
    ports:
      - "80:80"
      - "443:443"
    volumes:
      - /opt/docker/pwpush/nginx/nginx.conf:/etc/nginx/nginx.conf:ro
      - /opt/docker/pwpush/nginx/conf.d:/etc/nginx/conf.d:ro
      - /opt/docker/pwpush/cert:/etc/ssl/certs:ro
    restart: unless-stopped

  postgres:
    image: postgres:10
    container_name: pwpush_db
    volumes:
      - /opt/docker/pwpush/db/:/var/lib/postgresql/data:rw
    environment:
      PUID: "1000"
      PGID: "1000"
      POSTGRES_USER: ${POSTGRES_USER}
      POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
      POSTGRES_DB: ${POSTGRES_DB}
    restart: unless-stopped 


  passwordpusher:
    image: pglombardo/pwpush-postgres:latest
    container_name: pwpush
    environment:
      PWP_PRECOMPILE: 'true'
      PUID: "1000"
      PGID: "1000"
      PWP__PW__EXPIRE_AFTER_DAYS_DEFAULT: "1"
      PWP__PW__EXPIRE_AFTER_DAYS_MIN: "1"
      PWP__PW__EXPIRE_AFTER_DAYS_MAX: "5"
      PWP__PW__EXPIRE_AFTER_VIEWS_DEFAULT: "1"
      PWP__PW__EXPIRE_AFTER_VIEWS_MIN: "1"
      PWP__PW__EXPIRE_AFTER_VIEWS_MAX: "5"
      PWP__PW__RETRIEVAL_STEP_DEFAULT: "true"
      PWP__BRAND__TITLE: "Secure Password Sharing"
      PWP__BRAND__TAGLINE: "Everything just works"
      PWP__BRAND__LIGHT_LOGO: "https://www.mysite.com/wp-content/themes/mysite/images/mysite-logo-light.svg"
      PWP__BRAND__DARK_LOGO: "https://www.mysite.com/wp-content/themes/mysite/images/mysite-logo-light.svg"
      PWP__HOST_DOMAIN: "pwpush.mysite.com"
      PWP__OVERRIDE_BASE_URL: "https://pwpush.mysite.com"
      DATABASE_URL: "postgres://${POSTGRES_USER}:${POSTGRES_PASSWORD}@postgres:5432/${POSTGRES_DB}"
      PWP__ENABLE_LOGINS: "true"
      PWP__MAIL__SMTP_ADDRESS: "mail.smtp.com"
      PWP__MAIL__MAILER_SENDER: "pwpush@mysite.com"
      PWP__MAIL__SMTP_USER_NAME: "pwpush-user"
      PWP__MAIL__SMTP_PASSWORD: ${PWP__MAIL__SMTP_PASSWORD}
      PWP__MAIL__SMTP_AUTHENTICATION: login
      PWP__ENABLE_FILE_PUSHES: "true"
      PWP__FILES__STORAGE: "local"
      PWP__FILES__EXPIRE_AFTER_DAYS_MAX: "7"
      PWP__FILES__EXPIRE_AFTER_VIEWS_MAX: "3"
      PWP__FILES__RETRIEVAL_STEP_DEFAULT: "true"
    volumes:
      - /home/ubuntu/pwpush/storage:/opt/PasswordPusher/storage:rw
      - type: bind
        source: /home/ubuntu/pwpush/bootstrap-litera.css
        target: /opt/PasswordPusher/app/assets/stylesheets/bootstrap-litera.css

    depends_on:
      - postgres
    links:
     - postgres:postgres
    restart: unless-stopped

@CroHammeR
Copy link

CroHammeR commented Feb 10, 2023

I have the same problem. Browser Console reports the same.
under "opt/PasswordPusher/storage/" a folder is created, then another folder with a file the size of the upload but with a random name and without file extension.

push Password works normally only file push unfortunately not

pglombardo/pwpush-ephemeral
i mount /opt/PasswordPusher/

Browser Console:
POST https://mysite.com/de/f 403 | @hotwired--turbo-5a50d1a71839c59bc7f5ede0ad4d905fd456019a2977c380298f4046acf4f938.js:1

@pglombardo
Copy link
Owner

I have the same problem. Browser Console reports the same.

That console message is benign & not related.

under "opt/PasswordPusher/storage/" a folder is created, then another folder with a file the size of the upload but with a random name and without file extension.

That is good. It means that the file uploaded successfully. the random name without file extension is a security step to anonymize the file (to an extent).

In any case, I'm trying to reproduce this now and will post back soon.

@pglombardo
Copy link
Owner

First test without nginx works:

docker run --env-file .dockerenv --volume /tmp/this:/opt/PasswordPusher/storage:rw -p "5100:5100" pglombardo/pwpush-ephemeral:1.26.3

...Using a docker-env file similar to this.

So it seems like the issue is with nginx somewhere. I'll try that next.

@pglombardo
Copy link
Owner

pglombardo commented Feb 18, 2023

Thanks for all the patience on this issue here. After some fixes, I have an updated Password Pusher with nginx example here.

The two key changes I had to make are:

  1. Set the following environment variables in the pwpush container to enable log out put in your Password Pusher container.
PWP__LOG_TO_STDOUT=true
PWP__LOG_LEVEL=info

This will likely reveal errors and/or warning when you attempt file uploads.

  1. Make sure to have the following in your nginx.conf file (as shown in the example linked above):
proxy_set_header X-Forwarded-Host   $http_host;
proxy_set_header X-Forwarded-For    $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto  $scheme;
proxy_set_header Origin             $scheme://$http_host;
proxy_set_header Host               $http_host;
  1. Use release 1.26.3 or later. I will update the release tag this weekend but haven't done so yet.

Since the stand-alone pwpush container uploads files without issue, the problem is very likely to be in the nginx configuration.

If the above steps above don't resolve the issue for you, the additional logging (PWP__LOG_TO_STDOUT) should at least reveal more information to us.

Could you both verify and try out these settings and let me know?

@DecisionIT
Copy link
Author

HI @pglombardo

I tried your suggestions, and was unsuccessful in getting it to work.

Just so you know, I tired with and without nginx, and I got the same results. The files upload, and I can see them on the server, but the links always show as 'expired' when I try to access them.

Here is the out put of the docker logs:

With nginx (the redacted IPs were all the same IP):

Password Pusher: migrating database to latest...
Password Pusher: precompiling assets...
Password Pusher: starting puma webserver...
[63] Puma starting in cluster mode...
[63] * Puma version: 6.1.0 (ruby 3.2.1-p31) ("The Way Up")
[63] *  Min threads: 5
[63] *  Max threads: 5
[63] *  Environment: production
[63] *   Master PID: 63
[63] *      Workers: 2
[63] *     Restarts: (✔) hot (✖) phased
[63] * Preloading application
[63] * Listening on http://0.0.0.0:5100
[63] Use Ctrl-C to stop
[63] - Worker 0 (PID: 65) booted in 0.01s, phase: 0
[63] - Worker 1 (PID: 66) booted in 0.01s, phase: 0
I, [2023-02-22T14:53:47.031540 #66]  INFO -- : [e1571258-84c2-41b4-97d4-a787d2b18b42] method=GET path=/en format=html controller=PasswordsController action=new status=200 duration=238.83 view=82.54 db=62.35 user_id=1 ip=redacted forwarded_for=redacted
I, [2023-02-22T14:54:06.933052 #65]  INFO -- : [6e1e1af6-5e42-4af0-a8b0-6fec27ba94e9] method=GET path=/en/f/new format=html controller=FilePushesController action=new status=200 duration=109.82 view=39.05 db=14.09 user_id=1 ip=redacted forwarded_for=redacted
I, [2023-02-22T14:54:14.363155 #65]  INFO -- : [cb826cda-05a5-4561-a9c3-6c429fb1baf2]   Disk Storage (0.4ms) Uploaded file to key: 09i8e7zwox3n6hmiyhq5802goqfb (checksum: p9xzIlwo3YmxECssDE5aCw==)
I, [2023-02-22T14:54:14.367416 #65]  INFO -- : [cb826cda-05a5-4561-a9c3-6c429fb1baf2] method=POST path=/en/f format=turbo_stream controller=FilePushesController action=create status=302 duration=72.40 view=0.00 db=37.95 location=https://pwpush.mysite.com/en/f/hqo71jfqn6aisg/preview user_id=1 ip=redacted forwarded_for=redacted
I, [2023-02-22T14:54:14.451188 #65]  INFO -- : [eae0cf6e-bc73-4c8e-95d9-a4e488d27945] method=GET path=/en/f/hqo71jfqn6aisg/preview format=turbo_stream controller=FilePushesController action=preview status=200 duration=20.58 view=15.47 db=1.53 user_id=1 ip=redacted forwarded_for=redacted
I, [2023-02-22T14:54:29.100428 #65]  INFO -- : [52656081-e509-4327-b8cf-f1c1bbad3309] method=GET path=/en/p/hqo71jfqn6aisg/r format=html controller=PasswordsController action=preliminary status=200 duration=26.90 view=6.25 db=15.63 user_id=1 ip=redacted forwarded_for=redacted

Without nginx:

Password Pusher: migrating database to latest...
Password Pusher: precompiling assets...
Password Pusher: starting puma webserver...
[63] Puma starting in cluster mode...
[63] * Puma version: 6.1.0 (ruby 3.2.1-p31) ("The Way Up")
[63] *  Min threads: 5
[63] *  Max threads: 5
[63] *  Environment: production
[63] *   Master PID: 63
[63] *      Workers: 2
[63] *     Restarts: (✔) hot (✖) phased
[63] * Preloading application
[63] * Listening on http://0.0.0.0:5100
[63] Use Ctrl-C to stop
[63] - Worker 0 (PID: 65) booted in 0.01s, phase: 0
[63] - Worker 1 (PID: 66) booted in 0.01s, phase: 0
I, [2023-02-22T15:31:42.176307 #66]  INFO -- : [84a0672b-0fce-4468-b979-f2894b726dfd] method=GET path=/en format=html controller=PasswordsController action=new status=200 duration=145.85 view=74.15 db=31.97 user_id=1 ip=redacted
I, [2023-02-22T15:31:46.863054 #66]  INFO -- : [78ad0a6c-7299-4ed4-afd6-562daad00b22] method=GET path=/en/f/new format=html controller=FilePushesController action=new status=200 duration=29.77 view=14.42 db=3.35 user_id=1 ip=redacted
I, [2023-02-22T15:31:53.772600 #66]  INFO -- : [6a730f4e-ed8b-4425-abf2-112c92417562]   Disk Storage (1.9ms) Uploaded file to key: ffb9rrnkjygkcrmuypzcnz1c50el (checksum: p9xzIlwo3YmxECssDE5aCw==)
I, [2023-02-22T15:31:53.776915 #66]  INFO -- : [6a730f4e-ed8b-4425-abf2-112c92417562] method=POST path=/en/f format=turbo_stream controller=FilePushesController action=create status=302 duration=67.18 view=0.00 db=32.44 location=http://pwpush.mysite.com:5100/en/f/3zlnwqow2xxwhetidwe/preview user_id=1 ip=redacted
I, [2023-02-22T15:31:53.864181 #66]  INFO -- : [ba837a04-f20c-4814-85b8-d4cb519d77e3] method=GET path=/en/f/3zlnwqow2xxwhetidwe/preview format=turbo_stream controller=FilePushesController action=preview status=200 duration=19.74 view=15.49 db=0.68 user_id=1 ip=redacted
I, [2023-02-22T15:32:25.611473 #66]  INFO -- : [0b152c99-8fd2-4fea-9844-a640c729c9b9] method=GET path=/en/p/3zlnwqow2xxwhetidwe/r format=html controller=PasswordsController action=preliminary status=200 duration=13.25 view=3.30 db=4.79 ip=redacted

If there are additional logs that you would like me to provide, please let me know, and I can get those to you.

@pglombardo
Copy link
Owner

Hi @DecisionIT - apologies for the late reply. I will take another look at this issue today. I'll post back soon.

@DecisionIT
Copy link
Author

@pglombardo, no worries, I haven't had time to continue working on it either.

@m3nu
Copy link
Contributor

m3nu commented Apr 20, 2023

Links to uploaded files do not work and just say they are expired.

Had this issue on PikaPods. It worked after removing those env vars:

FORCE_SSL, PWP__HOST_PROTOCOL, PWP__OVERRIDE_BASE_URL

Since those are all proxy-related, they may interfere with it somehow. We use Caddy ourselves.

@DecisionIT
Copy link
Author

@m3nu Thanks for the suggestions. Unfortunately, turning off these options did work for me.

@pglombardo
Copy link
Owner

I updated the release tag to the latest release. Could all of you re-pull that docker tag and try again? This issue has been open for too long - I'd like to fix this for you all.

@DecisionIT
Copy link
Author

Hi @pglombardo, I updated the docker container using the release tag. The issue is still there, I can't successfully push files.

If you'd like, we can set up a remote session so that you can take a look at it directly. Let me know if you are interested in doing this.

@pglombardo
Copy link
Owner

No luck on this one... I may take you up on your helpful offer. Let me setup nginx and pwpush myself first so I'm sure I won't waste your time.

@assices
Copy link

assices commented May 12, 2023

Hello,

My Pw Pusher runs on Kubernetes with Treafik reverse proxy as frontend.
I had the same problem too (expired link) with PWP__OVERRIDE_BASE_URL configured.

I solved by disabling PWP__OVERRIDE_BASE_URL only.

@m4gn3to
Copy link

m4gn3to commented Jun 22, 2023

I'm facing the same error.
I can't upload any file.
I've disabled the variables mentioned above (I'm using settings.yml) but still getting the same error....

@pglombardo
Copy link
Owner

Hi all just a heads up that I'm traveling for the next month. My time is limited but I'll try to get back to this soon. Apologies.

@assices
Copy link

assices commented Jun 23, 2023

I'm facing the same error. I can't upload any file. I've disabled the variables mentioned above (I'm using settings.yml) but still getting the same error....

Could you share settings.yml file?

@m4gn3to
Copy link

m4gn3to commented Jul 18, 2023

Sure.

Here you have

settings.txt

@lauraled
Copy link

lauraled commented Jul 18, 2023

Hello,
we're currently experiencing the same issue. File pushes sometimes don't work at all (getting back HTTP error 500 directly from PasswordPusher) and sometimes it works, but the 'Push It!' button endlessly shows 'Pushing...'. The network tab in the dev console shows a 403 in that case. The push can be seen in the dashboard and the file can actually be accessed, so the creation seems to succeed.
Removing the PWP__OVERRIDE_BASE_URL environment variable unfortunately does not work.

However, I noticed that in the first error case this error message in the PasswordPusher logs, when setting the log level to debug:

D, [2023-07-18T12:21:21.670347 #12] DEBUG -- : source=rack-timeout id=414b84e3-08f0-402c-95c1-dbf7b209d9b9 timeout=15000ms state=ready
D, [2023-07-18T12:21:21.675620 #12] DEBUG -- : source=rack-timeout id=414b84e3-08f0-402c-95c1-dbf7b209d9b9 timeout=15000ms service=5ms state=active
D, [2023-07-18T12:21:21.733641 #12] DEBUG -- : [414b84e3-08f0-402c-95c1-dbf7b209d9b9]   TRANSACTION (0.4ms)  BEGIN
D, [2023-07-18T12:21:21.734666 #12] DEBUG -- : [414b84e3-08f0-402c-95c1-dbf7b209d9b9]   ActiveStorage::Blob Create (0.9ms)  INSERT INTO `active_storage_blobs` (`key`, `filename`, `content_type`, `metadata`, `service_name`, `byte_size`, `checksum`, `created_at`) VALUES ('3qatu8hu3u4focxs5fxml1lzmcuq', '2023-07-08 00_46_02-Window.png', 'image/png', NULL, 'local', 19095, 'l02rBtrWngjP74uZl3Stag==', '2023-07-18 12:21:21')
D, [2023-07-18T12:21:21.740397 #12] DEBUG -- : [414b84e3-08f0-402c-95c1-dbf7b209d9b9]   TRANSACTION (5.2ms)  COMMIT
D, [2023-07-18T12:21:21.742395 #12] DEBUG -- : [414b84e3-08f0-402c-95c1-dbf7b209d9b9]   Disk Storage (0.5ms) Generated URL for file at key: 3qatu8hu3u4focxs5fxml1lzmcuq (http://{BASE_URL}/rails/active_storage/disk/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaDdDam9JYTJWNVNTSWhNM0ZoZEhVNGFIVXpkVFJtYjJONGN6Vm1lRzFzTVd4NmJXTjFjUVk2QmtWVU9oRmpiMjUwWlc1MFgzUjVjR1ZKSWc1cGJXRm5aUzl3Ym1jR093WlVPaE5qYjI1MFpXNTBYMnhsYm1kMGFHa0NsMG82RFdOb1pXTnJjM1Z0U1NJZGJEQXlja0owY2xkdVoycFFOelIxV213elUzUmhaejA5QmpzR1ZEb1JjMlZ5ZG1salpWOXVZVzFsT2dwc2IyTmhiQT09IiwiZXhwIjoiMjAyMy0wNy0xOFQxMjoyNjoyMS43NDFaIiwicHVyIjoiYmxvYl90b2tlbiJ9fQ==--a1a973942ccb8c4aaa73ec3da2859d3cd13b4f71)
D, [2023-07-18T12:21:21.743951 #12] DEBUG -- : [414b84e3-08f0-402c-95c1-dbf7b209d9b9]   User Load (0.5ms)  SELECT `users`.* FROM `users` WHERE `users`.`id` = 1 ORDER BY `users`.`id` ASC LIMIT 1
I, [2023-07-18T12:21:21.744456 #12]  INFO -- : [414b84e3-08f0-402c-95c1-dbf7b209d9b9] method=POST path=/rails/active_storage/direct_uploads format=json controller=ActiveStorage::DirectUploadsController action=create status=200 duration=71.48 view=0.27 db=48.79 user_id=1 ip={SRC_IP} forwarded_for={SRC_IP}
D, [2023-07-18T12:21:21.744991 #12] DEBUG -- : source=rack-timeout id=414b84e3-08f0-402c-95c1-dbf7b209d9b9 timeout=15000ms service=75ms state=completed
D, [2023-07-18T12:21:21.768472 #11] DEBUG -- : source=rack-timeout id=460b98a5-86ad-48d1-a369-bb48a0c6138c timeout=15000ms state=ready
D, [2023-07-18T12:21:21.774003 #11] DEBUG -- : source=rack-timeout id=460b98a5-86ad-48d1-a369-bb48a0c6138c timeout=15000ms service=6ms state=active
I, [2023-07-18T12:21:21.774758 #11]  INFO -- : [460b98a5-86ad-48d1-a369-bb48a0c6138c]   Disk Storage (0.9ms) Uploaded file to key: 3qatu8hu3u4focxs5fxml1lzmcuq (checksum: l02rBtrWngjP74uZl3Stag==)
D, [2023-07-18T12:21:21.776832 #11] DEBUG -- : [460b98a5-86ad-48d1-a369-bb48a0c6138c]   User Load (0.7ms)  SELECT `users`.* FROM `users` WHERE `users`.`id` = 1 ORDER BY `users`.`id` ASC LIMIT 1
I, [2023-07-18T12:21:21.777455 #11]  INFO -- : [460b98a5-86ad-48d1-a369-bb48a0c6138c] method=PUT path=/rails/active_storage/disk/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaDdDam9JYTJWNVNTSWhNM0ZoZEhVNGFIVXpkVFJtYjJONGN6Vm1lRzFzTVd4NmJXTjFjUVk2QmtWVU9oRmpiMjUwWlc1MFgzUjVjR1ZKSWc1cGJXRm5aUzl3Ym1jR093WlVPaE5qYjI1MFpXNTBYMnhsYm1kMGFHa0NsMG82RFdOb1pXTnJjM1Z0U1NJZGJEQXlja0owY2xkdVoycFFOelIxV213elUzUmhaejA5QmpzR1ZEb1JjMlZ5ZG1salpWOXVZVzFsT2dwc2IyTmhiQT09IiwiZXhwIjoiMjAyMy0wNy0xOFQxMjoyNjoyMS43NDFaIiwicHVyIjoiYmxvYl90b2tlbiJ9fQ==--a1a973942ccb8c4aaa73ec3da2859d3cd13b4f71 format=*/* controller=ActiveStorage::DiskController action=update status=204 duration=4.28 view=0.00 db=0.00 user_id=1 ip={SRC_IP} forwarded_for={SRC_IP}
D, [2023-07-18T12:21:21.777972 #11] DEBUG -- : source=rack-timeout id=460b98a5-86ad-48d1-a369-bb48a0c6138c timeout=15000ms service=10ms state=completed
D, [2023-07-18T12:21:21.807600 #11] DEBUG -- : source=rack-timeout id=bf324042-c973-4c46-88c6-99817ecf0990 timeout=15000ms state=ready
D, [2023-07-18T12:21:21.810752 #11] DEBUG -- : source=rack-timeout id=bf324042-c973-4c46-88c6-99817ecf0990 timeout=15000ms service=3ms state=active
D, [2023-07-18T12:21:21.811800 #11] DEBUG -- : [bf324042-c973-4c46-88c6-99817ecf0990]   User Load (0.5ms)  SELECT `users`.* FROM `users` WHERE `users`.`id` = 1 ORDER BY `users`.`id` ASC LIMIT 1
D, [2023-07-18T12:21:21.816024 #11] DEBUG -- : [bf324042-c973-4c46-88c6-99817ecf0990]   FilePush Count (2.7ms)  SELECT COUNT(*) FROM `file_pushes` WHERE `file_pushes`.`user_id` = 1 AND `file_pushes`.`expired` = FALSE
I, [2023-07-18T12:21:21.818499 #11]  INFO -- : [bf324042-c973-4c46-88c6-99817ecf0990] method=POST path=/de/f format=turbo_stream controller=FilePushesController action=create status=500 duration=9.31 view=0.00 db=3.25 user_id=1 ip={SRC_IP} forwarded_for={SRC_IP}
F, [2023-07-18T12:21:21.822213 #11] FATAL -- : [bf324042-c973-4c46-88c6-99817ecf0990]
[bf324042-c973-4c46-88c6-99817ecf0990] ActionView::Template::Error (First argument in form cannot contain nil or be empty):
[bf324042-c973-4c46-88c6-99817ecf0990]     17: >
[bf324042-c973-4c46-88c6-99817ecf0990]     18: <%= render partial: "shared/topnav" %>
[bf324042-c973-4c46-88c6-99817ecf0990]     19:
[bf324042-c973-4c46-88c6-99817ecf0990]     20: <%= form_for @push, data: { action: 'form#submit' } do |f| %>
[bf324042-c973-4c46-88c6-99817ecf0990]     21:     <div class='row'>
[bf324042-c973-4c46-88c6-99817ecf0990]     22:         <div class='col-sm-8'>
[bf324042-c973-4c46-88c6-99817ecf0990]     23:             <div class='row mb-3'>
[bf324042-c973-4c46-88c6-99817ecf0990]
[bf324042-c973-4c46-88c6-99817ecf0990] app/views/file_pushes/new.html.erb:20
[bf324042-c973-4c46-88c6-99817ecf0990] app/controllers/file_pushes_controller.rb:225:in `block (2 levels) in create'
[bf324042-c973-4c46-88c6-99817ecf0990] app/controllers/file_pushes_controller.rb:222:in `create'
[bf324042-c973-4c46-88c6-99817ecf0990] app/controllers/application_controller.rb:14:in `custom_set_locale_from_url'
D, [2023-07-18T12:21:21.825605 #11] DEBUG -- : source=rack-timeout id=bf324042-c973-4c46-88c6-99817ecf0990 timeout=15000ms service=18ms state=completed`

We're running PasswordPusher in a Docker container as well (pwpush-mysql), using the latest tag. I also pulled the newest image from yesterday, but the behaviour remains the same. We run a NGINX container in front of it. I followed the documentation for the docker-compose.yml and the NGINX config.
Is this error message relevant?

@assices
Copy link

assices commented Jul 18, 2023

Sure.

Here you have

settings.txt

Did you enable file push? It seams disabled...

enable_file_pushes: false

At my side file push works, but I still get this issue #1182

The workaround I found when preview page doesn't appear is to jump to Dashboard-> Files and get Push Link from Audit section.

ciao,
Andrea

@DecisionIT
Copy link
Author

An update..... so file pushes are working.... kind of.

I removed and recreated the docker containers, and it seemed to start working. When uploading files, it will just hang on "Pushing", but clicking on "Pushing" again will take us to the preview with the link. We are able to download the file using that link, we no longer get the link expired page. This is the same issue that @assices seems to be having and the same that is described in #1182.

What does not work is when we try to upload multiple files or files larger than 2mb. The "Pushing" button is not clickable and the files never upload to the storage.

@assices
Copy link

assices commented Jul 19, 2023

When uploading files, it will just hang on "Pushing", but clicking on "Pushing" again will take us to the preview with the link

Yes, same behavior on my side, but the second click on "Pushing" creates another shared link.
You can check this from Dashboard/File.

This is the reason I prefer to get shared link directly from Dashboard/File after first push.

On my side, no issues with multiple files or files larger than 2mb using the method decribed before.

ciao
Andrea

@m4gn3to
Copy link

m4gn3to commented Jul 24, 2023

In the last version it works.

Thanks.

@m4gn3to
Copy link

m4gn3to commented Jul 28, 2023

I was wrong sorry...

It let me upload files, but I can't use it, it always says expired link...

@pglombardo
Copy link
Owner

Just an update for everyone here. My apologies that this issue has persisted for so long. I'm back from vacation, back to work at HiveMQ and catching up on Password Pusher issues. As the project has gotten more popular, the number of issues has increased so I'm spread a bit thin.

A couple of notes and "Hail Mary"s :

404 == Link Expired (Security Feature)

The app will always show "Expired" for non existent pushes:

https://pwpush.com/p/doesnotexist
https://pwpush.com/f/doesnotexisteither

This is a security feature to obfuscate where pushes may have existed in the past.

override_base_url was broken pre v1.29.3

In v1.29.3, I fixed a bug where the wrong URL would be generated for File and URL pushes when using override_base_url. Details in #1237

If you are using that option, uploading Files and get back a URL with /p/ in the URL - then that fix is for you.

As for everyone else, I know there is something amiss with file uploads when hosting Password Pusher with a proxy like nginx in the front...

The weekend is almost here. I'll aim to dive deeper into this issue before Monday. Thanks to everyone for your patience.

@pglombardo
Copy link
Owner

My sense that this issue and #1193 are a mix of issues which make fixing this more difficult but I do have some good news at least for a subset of users here.

nginx, pwpush-ephemeral & file uploads:

This morning I tested the Docker & Nginx example setup from scratch and I got the same stuck on "Pushing.." error (File uploads with pwpush-ephemeral and local storage). After a bit of digging, I found that File uploads were getting blocked by per second throttling.

If you are having trouble uploading files, please try setting PWP__THROTTLING__SECOND=20 and please post back your results.

With this, I was able to upload files working without issue.

When I switched to cloud storage (Amazon S3) I got the CORs error in the browser console but was fixed by applying the right CORs policy to the S3 buckets. Documentation here.

There is more but I don't want to overwhelm the thread. I put other findings in the Troubleshooting wiki page.

I hope that this helps at least some of you here.

@lauraled
Copy link

Hey, thanks a lot for looking at this issue. I tested on my side and uploading files works now. However, when I try to access the file push I get the message that the link has expired. When I check the status of the file push in the dashboard, it's shown as active.

I have debug logs enabled and I noticed this message when trying to access the file push:

D, [2023-08-28T06:12:11.690629 #10] DEBUG -- : source=rack-timeout id=e6d61f72-ece8-4000-ae00-b2a4292037eb timeout=15000ms state=ready
D, [2023-08-28T06:12:11.694185 #10] DEBUG -- : source=rack-timeout id=e6d61f72-ece8-4000-ae00-b2a4292037eb timeout=15000ms service=4ms state=active
D, [2023-08-28T06:12:11.700009 #10] DEBUG -- : [e6d61f72-ece8-4000-ae00-b2a4292037eb]   Password Load (0.8ms)  SELECT `passwords`.* FROM `passwords` WHERE `passwords`.`url_token` = '4gc07h6j1ytn2-jcuvq' LIMIT 1
I, [2023-08-28T06:12:11.704548 #10]  INFO -- : [e6d61f72-ece8-4000-ae00-b2a4292037eb] method=GET path=/de/p/4gc07h6j1ytn2-jcuvq/r format=html controller=PasswordsController action=preliminary status=200 duration=6.87 view=2.94 db=0.83 ip=X.X.X.X forwarded_for=Y.Y.Y.Y, Z.Z.Z.Z
D, [2023-08-28T06:12:11.705191 #10] DEBUG -- : source=rack-timeout id=e6d61f72-ece8-4000-ae00-b2a4292037eb timeout=15000ms service=15ms state=completed

I might be wrong, but to me that SQL statement looks like it's looking for the file push under the passwords table, where it does not exist, instead of the file_pushes table.
Is my assumption right?

Also hopefully some more people will test this workaround and post their findings, just in case this behaviour is something unique to my instance.

@pglombardo
Copy link
Owner

I might be wrong, but to me that SQL statement looks like it's looking for the file push under the passwords table, where it does not exist, instead of the file_pushes table.
Is my assumption right?

I think you may be right. There was a bug in an older version of Password Pusher that caused this. What version are you using and if not the latest, could you try v1.31.2?

@lauraled
Copy link

Yes, I looks like it was that bug that caused this. I was using a Docker container image from 5 weeks ago. I pulled the newest image and now the file pushing works flawlessly. Thank you so much!

@DecisionIT
Copy link
Author

@pglombardo Thanks for all your work. Uploading files is working now after adding the PWP__THROTTLING__SECOND=20.

@pglombardo
Copy link
Owner

pglombardo commented Aug 31, 2023

Thanks for confirming @lauraled & @DecisionIT - glad to finally see some progress.

As a summary of the solution for this issue:

  1. Make sure you are running the release, latest or latest version'd tag
  2. Set PWP__THROTTLING__SECOND=20 (although this will be the default in upcoming releases)

WIth that said, I want to aim at closing this issue when possible. If these two steps don't solve the issue for you, could you please file a new issue so that we can diagnose your case separately? It would be much appreciated (and much easier to diagnose).

I'll look to close this issue soon (assuming no objections).

cc: @CroHammeR @m3nu @m4gn3to @assices

@DecisionIT
Copy link
Author

@pglombardo I'm ok with you closing the issue. Thanks again for your help.

@pglombardo
Copy link
Owner

Closing this issue. Thanks all for the input and help.

For others visiting here, please see this comment for a summary and solution.

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

7 participants