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

Data export file download link not generated, button to request reappears #26551

Closed
cadusilva opened this issue Aug 19, 2023 · 7 comments
Closed
Labels
bug Something isn't working status/to triage This issue needs to be triaged

Comments

@cadusilva
Copy link

Steps to reproduce the problem

  1. Go to "Import and Export > Data export"
  2. Click "Request your archive" button
  3. The download link is never generated, no error is shown and the step 2 button appears again

Expected behaviour

Download link generated and downloadable

Actual behaviour

Nothing happens, things go back to the start

Detailed description

When the user tries to generate a data export file, everything runs well until after the file is zipped. Then, when the time comes to upload it to Backblaze B2 via S3 API, the process fails. This is the debug log:

Aug 18 23:27:10 bolha bundle[793821]: I, [2023-08-18T23:27:10.204799 #793821]  INFO -- : [paperclip] Trying to link /tmp/archive20230818-793821-o89taw.zip to /tmp/d3260550e956e9d959ad7e70e869d89220230818-793821-ytq0yb.zip
Aug 18 23:27:10 bolha bundle[793821]: I, [2023-08-18T23:27:10.205951 #793821]  INFO -- : [paperclip] Trying to link /tmp/d3260550e956e9d959ad7e70e869d89220230818-793821-ytq0yb.zip to /tmp/d3260550e956e9d959ad7e70e869d89220230818-793821-wr6cyp.zip
Aug 18 23:27:10 bolha bundle[793821]: I, [2023-08-18T23:27:10.206364 #793821]  INFO -- : Command :: file -b --mime '/tmp/d3260550e956e9d959ad7e70e869d89220230818-793821-wr6cyp.zip'
Aug 18 23:27:10 bolha bundle[793821]: I, [2023-08-18T23:27:10.234564 #793821]  INFO -- : [paperclip] Trying to link /tmp/d3260550e956e9d959ad7e70e869d89220230818-793821-ytq0yb.zip to /tmp/d3260550e956e9d959ad7e70e869d89220230818-793821-j1csv3.zip
Aug 18 23:27:10 bolha bundle[793821]: I, [2023-08-18T23:27:10.235353 #793821]  INFO -- : Command :: file -b --mime '/tmp/d3260550e956e9d959ad7e70e869d89220230818-793821-j1csv3.zip'
Aug 18 23:27:10 bolha bundle[793821]: D, [2023-08-18T23:27:10.264288 #793821] DEBUG -- :   TRANSACTION (1.0ms)  BEGIN
Aug 18 23:27:10 bolha bundle[793821]: D, [2023-08-18T23:27:10.265722 #793821] DEBUG -- :   Backup Update (1.2ms)  UPDATE "backups" SET "dump_file_name" = 'archive-20230819022710-c664e808c099e02eb090da583a1cb409.zip', "dump_content_type" = 'application/zip', "dump_updated_at" = '2023-08-19 02:27:10.205429', "processed" = TRUE, "updated_at" = '2023-08-19 02:27:10.261951', "dump_file_size" = 232051433 WHERE "backups"."id" = 12
Aug 18 23:27:10 bolha bundle[793821]: I, [2023-08-18T23:27:10.267856 #793821]  INFO -- : [paperclip] saving backups/dumps/000/000/012/original/archive-20230819022710-c664e808c099e02eb090da583a1cb409.zip
Aug 18 23:27:10 bolha bundle[794180]: I, [2023-08-18T23:27:10.572427 #794180]  INFO -- : [fbbc4a5f-246e-462e-a986-63db791a3688] method=GET path=/api/v1/custom_emojis format=html controller=Api::V1::CustomEmojisController action=index status=200 allocations=428334 duration=664.55 view=636.99 db=21.00
Aug 18 23:27:10 bolha bundle[793821]: D, [2023-08-18T23:27:10.743828 #793821] DEBUG -- : [httplog] POST http://s3.us-west-001.backblazeb2.com:443/bolha-one/backups/dumps/000/000/000/original/archive-20230819022710-c664h808r0929e02ec040da583g1cb409.zip?uploads completed with status code 400 in 0.152093 seconds
Aug 18 23:27:10 bolha bundle[793821]: D, [2023-08-18T23:27:10.745804 #793821] DEBUG -- :   TRANSACTION (1.2ms)  ROLLBACK
Aug 18 23:27:10 bolha bundle[793821]: D, [2023-08-18T23:27:10.748267 #793821] DEBUG -- :   Backup Load (1.1ms)  SELECT "backups".* FROM "backups" WHERE "backups"."id" = 12 LIMIT 1
Aug 18 23:27:10 bolha bundle[793821]: D, [2023-08-18T23:27:10.750257 #793821] DEBUG -- :   TRANSACTION (0.9ms)  BEGIN
Aug 18 23:27:10 bolha bundle[793821]: D, [2023-08-18T23:27:10.751590 #793821] DEBUG -- :   Backup Destroy (1.1ms)  DELETE FROM "backups" WHERE "backups"."id" = 12
Aug 18 23:27:10 bolha bundle[793821]: D, [2023-08-18T23:27:10.764421 #793821] DEBUG -- :   TRANSACTION (12.4ms)  COMMIT
Aug 18 23:27:10 bolha bundle[793821]: 2023-08-19T02:27:10.765Z pid=793821 tid=bhf1 class=BackupWorker jid=17ea472da0f0126c86ca185e elapsed=218.143 INFO: fail
Aug 18 23:27:10 bolha bundle[793821]: 2023-08-19T02:27:10.765Z pid=793821 tid=bhf1 WARN: {"context":"Job raised exception","job":{"retry":5,"queue":"pull","backtrace":true,"dead":false,"args":[12],"class":"BackupWorker","jid":"17ea472da0f0126c86ca185e","created_at":1692410249.9618533,"enqueued_at":1692411812.6217887,"error_message":"Unsupported value for canned acl 'private'","error_class":"Aws::S3::Errors::InvalidArgument","failed_at":1692410497.7625172,"retry_count":4,"error_backtrace":"eJy9zsEKwjAMgOFXkV282GZdBWWvIqJdG1xZ145knfj2VgX1LngLSeD7DxX0\naUQYDc/JpQjBLwgLRpcIuhxdQKDc3UDLRtZwwZHBXFmwG4RNhEJLta/LJfgO\nGE2fiBFs8BhnmEK++MhAxjOeCHlKsQxIVL4kda3atT6uztaEsK42P6SwFkoq\n3Uj1DPms3w1cYDsND7XZ/k112QSejX256ss93gGBsYHW\n","retried_at":1692411532.7850983}}
Aug 18 23:27:10 bolha bundle[793821]: 2023-08-19T02:27:10.765Z pid=793821 tid=bhf1 WARN: Aws::S3::Errors::InvalidArgument: Unsupported value for canned acl 'private'
Aug 18 23:27:10 bolha bundle[793821]: 2023-08-19T02:27:10.765Z pid=793821 tid=bhf1 WARN: /home/mastodon/live/vendor/bundle/ruby/3.2.0/gems/aws-sdk-core-3.180.0/lib/seahorse/client/plugins/raise_response_errors.rb:17:in `call'
Aug 18 23:27:10 bolha bundle[793821]: /home/mastodon/live/vendor/bundle/ruby/3.2.0/gems/aws-sdk-s3-1.132.1/lib/aws-sdk-s3/plugins/sse_cpk.rb:24:in `call'
Aug 18 23:27:10 bolha bundle[793821]: /home/mastodon/live/vendor/bundle/ruby/3.2.0/gems/aws-sdk-s3-1.132.1/lib/aws-sdk-s3/plugins/dualstack.rb:21:in `call'

If it helps, it appears that at Backblaze you can only set the entire bucket as public or private, not specific files. Changing the bucket to private breaks media links previously uploaded, but I haven't tested generating another export file because it takes time, so it's not viable anyway (breaks other things).

This problem isn't new or related to the beta version, it happened with v4.1.x versions too.

Mastodon instance

bolha.one

Mastodon version

4.2.0-beta1

Browser name and version

Firefox 116.0.3

Operating system

Windows 11

Technical details

S3 API-related info from .env.production:

# backblaze
S3_ENABLED=true
S3_PROTOCOL=https
S3_ENDPOINT=https://s3.us-west-001.backblazeb2.com
S3_HOSTNAME=s3.us-west-001.backblazeb2.com
S3_BUCKET=bolha-one
S3_REGION=us-west-001
S3_READ_TIMEOUT=120
S3_ALIAS_HOST=masto.cdn.bolha.one/file/bolha-one
S3_DISABLE_CHECKSUM_MODE=true
S3_FORCE_SINGLE_REQUEST=true
AWS_ACCESS_KEY_ID=XYZ
AWS_SECRET_ACCESS_KEY=XYZ
@cadusilva cadusilva added area/web interface Related to the Mastodon web interface bug Something isn't working status/to triage This issue needs to be triaged labels Aug 19, 2023
@renchap renchap removed the area/web interface Related to the Mastodon web interface label Aug 19, 2023
@ClearlyClaire
Copy link
Contributor

Hi! Try setting S3_PERMISSION to an empty string in .env.production

@cadusilva
Copy link
Author

Hi! Try setting S3_PERMISSION to an empty string in .env.production

It worked! After doing this, the export file generation and download was successful. Thank you.

In related questions, I noticed the file comes directly from Backblaze and not via the CDN I'm using. Is there a way for the link to be generated using the CDN hostname?

@ClearlyClaire
Copy link
Contributor

That's a known issue (#24380) though unfortunately we do not have a proper solution at this time.

@cadusilva
Copy link
Author

Alright, so I'll close this issue, glad that the export is working again. Thanks!

@p37307
Copy link

p37307 commented Sep 17, 2023

Hi! Try setting S3_PERMISSION to an empty string in .env.production

Would that be by adding S3_PERMISSION= to the .env.production file with nothing after the equal sign?

This is happening for me with Backblaze, Mastodon v4.2.0-rc1

@ClearlyClaire
Copy link
Contributor

Would that be by adding S3_PERMISSION= to the .env.production file with nothing after the equal sign?

Yes!

@p37307
Copy link

p37307 commented Sep 18, 2023

Would that be by adding S3_PERMISSION= to the .env.production file with nothing after the equal sign?

Yes!

That did the trick. Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working status/to triage This issue needs to be triaged
Projects
None yet
Development

No branches or pull requests

4 participants