We've moved discussions to Discord

Uploading files and avatar not working (Active Storage, S3, Heroku)

I deployed my app to Heroku and configured it to use Amazon S3 for images and files uploading, but it's still not working.

I've been trying different settings on Heroku, Amazon S3, updated config/storage.yml Amazon credentials. Also followed different articles and guides to set it up, but seemed not to be working at all on the Heroku environment.

It throws a 500 error when uploading a new avatar and it doesn't upload files when a user creates a record using ActionText.

Have you guys been able to set up Active Storage using S3? Would you recommend a different way of making Active Storage work on a Heroku environment?

Any help is appreciated!

Here are the logs for when I try uploading a new avatar:
2020-09-11T04:41:36.656120+00:00 app[web.1]: D, [2020-09-11T04:41:36.656017 #4] DEBUG -- : [5eba0d08-f044-4e41-af57-4f3282b4237c]   ProjectUser Load (1.9ms)  SELECT "project_users".* FROM "project_users" WHERE "project_users"."user_id" = $1  [["user_id", 6]]
2020-09-11T04:41:36.658926+00:00 app[web.1]: D, [2020-09-11T04:41:36.658833 #4] DEBUG -- : [5eba0d08-f044-4e41-af57-4f3282b4237c]   ProjectUser Destroy (1.9ms)  DELETE FROM "project_users" WHERE "project_users"."id" = $1  [["id", 3]]
2020-09-11T04:41:36.660993+00:00 app[web.1]: D, [2020-09-11T04:41:36.660910 #4] DEBUG -- : [5eba0d08-f044-4e41-af57-4f3282b4237c]   ProjectUser Destroy (1.7ms)  DELETE FROM "project_users" WHERE "project_users"."id" = $1  [["id", 9]]
2020-09-11T04:41:36.675817+00:00 app[web.1]: D, [2020-09-11T04:41:36.675711 #4] DEBUG -- : [5eba0d08-f044-4e41-af57-4f3282b4237c]   ApiToken Load (6.4ms)  SELECT "api_tokens".* FROM "api_tokens" WHERE "api_tokens"."user_id" = $1  [["user_id", 6]]
2020-09-11T04:41:36.688494+00:00 app[web.1]: D, [2020-09-11T04:41:36.688414 #4] DEBUG -- : [5eba0d08-f044-4e41-af57-4f3282b4237c]   User::ConnectedAccount Load (4.6ms)  SELECT "user_connected_accounts".* FROM "user_connected_accounts" WHERE "user_connected_accounts"."user_id" = $1  [["user_id", 6]]
2020-09-11T04:41:36.693777+00:00 app[web.1]: D, [2020-09-11T04:41:36.693687 #4] DEBUG -- : [5eba0d08-f044-4e41-af57-4f3282b4237c]   User Destroy (4.6ms)  DELETE FROM "users" WHERE "users"."id" = $1  [["id", 6]]
2020-09-11T04:41:36.695702+00:00 app[web.1]: D, [2020-09-11T04:41:36.695617 #4] DEBUG -- : [5eba0d08-f044-4e41-af57-4f3282b4237c]    (1.6ms)  ROLLBACK
2020-09-11T04:41:36.696830+00:00 app[web.1]: I, [2020-09-11T04:41:36.696746 #4]  INFO -- : [5eba0d08-f044-4e41-af57-4f3282b4237c] Completed 500 Internal Server Error in 140ms (ActiveRecord: 75.6ms | Allocations: 13018)
2020-09-11T04:41:36.699100+00:00 app[web.1]: F, [2020-09-11T04:41:36.699019 #4] FATAL -- : [5eba0d08-f044-4e41-af57-4f3282b4237c]
2020-09-11T04:41:36.699102+00:00 app[web.1]: [5eba0d08-f044-4e41-af57-4f3282b4237c] ActiveRecord::InvalidForeignKey (PG::ForeignKeyViolation: ERROR:  update or delete on table "users" violates foreign key constraint "fk_rails_b872a6760a" on table "projects"
2020-09-11T04:41:36.699103+00:00 app[web.1]: DETAIL:  Key (id)=(6) is still referenced from table "projects".
...
2020-09-11T04:41:36.710713+00:00 app[web.1]: I, [2020-09-11T04:41:36.710607 #4]  INFO -- : [5eba0d08-f044-4e41-af57-4f3282b4237c] Completed 500 Internal Server Error in 10ms (Views: 9.5ms | ActiveRecord: 0.0ms | Allocations: 1646)


Notifications
You’re not receiving notifications from this thread.