Migrating uploads to S3 for 'default'... rake aborted!

AI-generated summary

In a self-hosted Discourse setup, eextra is attempting to migrate uploads to S3 using rake uploads:migrate_to_s3 but encounters a NameError: uninitialized constant FileStore::ToS3Migration::Aws. They configured S3 environment variables including DISCOURSE_S3_BUCKET, DISCOURSE_S3_REGION, and credentials, but initially used EU_Frankfurt as the region — gerhard suggests using eu-central-1 instead, per AWS documentation. Even after correcting the region, the error persists. eextra shares the full stack trace and notes their discourse.conf lacks S3-specific settings, raising concern about missing configuration. Later, they confirm GlobalSetting.use_s3? returns true after updating app.yml, yet the migration still fails, indicating the issue may lie deeper in the code or environment setup, possibly around AWS SDK loading or missing dependencies.

NameError: uninitialized constant FileStore::ToS3Migration::Aws

I set the bucket according to the manual. Then I typed in the console but I can’t move the images. Why this bug ?
i put (app:/var/www/discourse# : )

DISCOURSE_S3_BUCKET=new-bucket \
DISCOURSE_S3_REGION=EU_Frankfurt \
DISCOURSE_S3_ACCESS_KEY_ID=dsadadassdadaIdsadY4 \
DISCOURSE_S3_SECRET_ACCESS_KEY=xyss1dsMtdsakcmjxBVsg1xsadaX \
rake uploads:migrate_to_s3

whether it’s a bug or maybe I misspelled something ?

Try eu-central-1 — see AWS service endpoints - AWS General Reference for a list of regions.

Unfortunately, it’s still a problem.

 >    Migrating uploads to S3 for 'default'...
>     rake aborted!
>     NameError: uninitialized constant FileStore::ToS3Migration::Aws
>     /var/www/discourse/lib/file_store/to_s3_migration.rb:159:in `migrate_to_s3'
>     /var/www/discourse/lib/file_store/to_s3_migration.rb:61:in `migrate'
>     /var/www/discourse/lib/tasks/uploads.rake:239:in `migrate_to_s3'
>     /var/www/discourse/lib/tasks/uploads.rake:218:in `block in migrate_to_s3_all_sites'
>     /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/rails_multisite-2.1.1/lib/rails_multisite/connection_management.rb:64:in `with_connection'
>     /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/rails_multisite-2.1.1/lib/rails_multisite/connection_management.rb:74:in `each_connection'
>     /var/www/discourse/lib/tasks/uploads.rake:216:in `migrate_to_s3_all_sites'
>     /var/www/discourse/lib/tasks/uploads.rake:212:in `block in <top (required)>'
>     /usr/local/bin/bundle:23:in `load'
>     /usr/local/bin/bundle:23:in `<main>'
>     Tasks: TOP => uploads:migrate_to_s3
>     (See full trace by running task with --trace)

reading other threads and trying to get to the problem I noticed that I have only such settings in the file. There shouldn’t be any data for S3 ?

my discourse.conf:

> hostname = 'dasda' 
> smtp_user_name = 'dadsafa' 
> smtp_address = 'fasfaf' 
> db_socket = '/var/run/postgresql' 
> developer_emails = 'dasda@zyz.com' 
> smtp_port = '587' 
> smtp_password = 'zxc' 
> db_host = '' 
> db_port = '' 
> force_https = 'true'

I set the app.yml data to s3 so that now GlobalSetting.use_s3? returns true

but I still can’t move the files to s3.