I am getting the following erroor when trying to use the direct upload functionality of ActiveStorage. I have searched for the error unexpected value at params[:whitelist_headers]
, and the only results that I found suggested to upgrade to the latest version of aws-sdk-s3
. However, I believe that I am using the latest version of s3. Here is my Gemfile:
# frozen_string_literal: true
source "https://rubygems.org"
ruby File.read(File.join(__dir__, ".ruby-version")).chomp
gem "rails", "~> 6.0"
gem "rails-i18n"
gem "bootsnap", require: false
gem "foreman"
gem "pg"
gem "puma", "~> 4.3"
...
...
...
gem 'aws-sdk-s3', require: false
gem 'mini_magick'
gem 'rack-cors
And the error message:
Started POST "/rails/active_storage/direct_uploads" for 127.0.0.1 at 2020-10-12 17:14:51 -0500
Processing by ActiveStorage::DirectUploadsController#create as JSON
Parameters: {"blob"=>{"filename"=>"Screen Shot 2020-10-02 at 4.02.49 PM.png", "content_type"=>"image/png", "byte_size"=>120011, "checksum"=>"06QCMFP69Z4HT6w98ugkyQ=="}, "direct_upload"=>{"blob"=>{"filename"=>"Screen Shot 2020-10-02 at 4.02.49 PM.png", "content_type"=>"image/png", "byte_size"=>120011, "checksum"=>"06QCMFP69Z4HT6w98ugkyQ=="}}}
(0.3ms) BEGIN
ActiveStorage::Blob Create (0.3ms) INSERT INTO "active_storage_blobs" ("key", "filename", "content_type", "byte_size", "checksum", "created_at") VALUES ($1, $2, $3, $4, $5, $6) RETURNING "id" [["key", "ai7p1m5pknvo2wstwc6nw8ihf31h"], ["filename", "Screen Shot 2020-10-02 at 4.02.49 PM.png"], ["content_type", "image/png"], ["byte_size", 120011], ["checksum", "06QCMFP69Z4HT6w98ugkyQ=="], ["created_at", "2020-10-12 22:14:51.332510"]]
(0.4ms) COMMIT
S3 Storage (0.8ms) Generated URL for file at key: ai7p1m5pknvo2wstwc6nw8ihf31h ()
Completed 500 in 10ms (ActiveRecord: 1.1ms | Allocations: 6659)
ArgumentError (unexpected value at params[:whitelist_headers]):
aws-sdk-core (3.46.2) lib/aws-sdk-core/param_validator.rb:32:in `validate!'
aws-sdk-core (3.46.2) lib/aws-sdk-core/param_validator.rb:13:in `validate!'
aws-sdk-core (3.46.2) lib/aws-sdk-core/plugins/param_validator.rb:23:in `call'
aws-sdk-core (3.46.2) lib/seahorse/client/plugins/raise_response_errors.rb:14:in `call'
Any help is appreciated
My problem was solved by replacing
gem 'aws-sdk-s3'
withgem 'aws-sdk'
in my Gemfile.This may not be an ideal solution, as the docs state the following: