Module SimpleS3Upload is not available

Please help, am trying to upload file to S3 through external but each time I fire the upload I got module SimpleS3Upload is not available I don’t know what I am doing wrong below is my snippet. Kindly help me.

uploads = socket.assigns.uploads
bucket = “tes-image”
key = “public/#{entry.client_name}”

config = %{
  region: region,
  access_key_id: System.fetch_env!("AWS_ACCESS_KEY_ID"),
  secret_access_key: System.fetch_env!("AWS_SECRET_ACCESS_KEY")

{:ok, fields} =
  SimpleS3Upload.sign_form_upload(config, bucket,
    key: key,
    content_type: entry.client_type,
    max_file_size: uploads[entry.upload_config].max_file_size,
    expires_in: :timer.hours(1)

meta = %{
  uploader: "S3",
  key: key,
  url: "http://#{bucket}.s3-#{config.region}",
  fields: fields

{:ok, meta, socket}



The module SimpleS3Upload isn’t included with Phoenix. You need to follow the link in the documentation: Simple, dependency-free S3 Form Upload using HTTP POST sigv4 · GitHub

So you can copy the code in the gist to your project.


Thank you @SergioV I appreciate it. This is the error I got next when I tried it is there any replacement :crypto.hmac

I fixed it with this

defp sha256(secret, msg), do: :crypto.mac(:hmac, :sha256, secret, msg)