HIGASHI-SHIHO-54B / my-my-project

0 stars 0 forks source link

画像登録(MVP後にS3とcarriawaveの設定を行います) #5

Open HIGASHI-SHIHO-54B opened 1 month ago

HIGASHI-SHIHO-54B commented 1 month ago

解決したいこと・達成したいものについて

gem 'carrierwave’の設定は完了したのですが、S3にて画像のアップロードを行おうとするとエラーが発生します。エラーを見てみるとfog-awsのプロバイダーが読み込まれていないと出ていました。いろいろなサイトを見て回って周辺のファイルを見直したりしていたらgemをインストールしなおしたりしていたら image 上記のような状態になりホスト3000が立ち上がらなくなりました。config/initializizers/carrierwave をすべてコメントアウトしapp/uploders/good_image_uploder.rbのファイル設定を storage :file #storage :fogへ変更しなおしました。 ここでエラーは元に戻ったのですがfogの設定ができていない状態になってしまいました。

もう一度app/uploders/good_image_uploder.rbのファイル設定を #storage :file storage :fog に戻し>config/initializizers/carrierwaveのコメントアウトを削除してみると image 上記の Fogというクラスやモジュールが認識されていないというエラーになってしまいました。 周辺のコードを見てみますがおかしなところを見つけられません。

聞きたいこと・アドバイスが欲しいこと

エラー解消のためにはどうすればよいかアドバイスをいただきたいです。

実装の際に参考にした資料等

※今起きているエラーや作成しているものに関して、そもそもどのような資料を参考に実装を進めているのか共有してください https://pikawaka.com/rails/carrierwave 上記サイトでfogの導入を行いました

現状のコードの状態がわかるURL(プルリクエスト・リポジトリ等)

※今の実装状態がわかるようにプルリクエストを作成したり、プルリクエストが作成できないものであればリポジトリURLを共有したうえでどこがかかわってくるのかを共有したり、スクリーンショット等で状況の共有を行ってください

現状のコードの状態がわかるURLのどこが関係していると考えているのか

app/uploders/good_image_uploder.rb▽


class GoodImageUploader < CarrierWave::Uploader::Base
# Include RMagick or MiniMagick support:
# include CarrierWave::RMagick
# include CarrierWave::MiniMagick

Choose what kind of storage to use for this uploader:

storage :file

storage :fog

Override the directory where uploaded files will be stored.

This is a sensible default for uploaders that are meant to be mounted:

def store_dir "uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}"

"uploads/#{model.class.to_s.underscore}/#{model.id}"

end

Provide a default URL as a default if there hasn't been a file uploaded:

def default_url 'good_placeholder' end

For Rails 3.1+ asset pipeline compatibility:

ActionController::Base.helpers.asset_path("fallback/" + [versionname, "default.png"].compact.join(''))

#

"/images/fallback/" + [versionname, "default.png"].compact.join('')

end

Process files as they are uploaded:

process scale: [200, 300]

#

def scale(width, height)

do something

end

Create different versions of your uploaded files:

version :thumb do

process resize_to_fit: [50, 50]

end

Add an allowlist of extensions which are allowed to be uploaded.

For images you might use something like this:

def extension_allowlist %w(jpg jpeg gif png) end

Override the filename of the uploaded files:

Avoid using model.id or version_name here, see uploader/store.rb for details.

def filename

"something.jpg"

end

end

config/initializizers/carrierwave ▽

require 'carrierwave/storage/abstract' require 'carrierwave/storage/file' require 'carrierwave/storage/fog' require 'fog/aws'

CarrierWave.configure do |config| config.fog_provider = 'fog/aws' config.fog_credentials = { provider: 'AWS', aws_access_key_id: ENV['AWS_ACCESS_KEY_ID'], # 環境変数 aws_secret_access_key: ENV['AWS_SECRET_ACCESS_KEY'], # 環境変数 region: 'ap-northeast-1', # アジアパシフィック(東京)を選択した場合 path_style: true } config.fog_public = false config.asset_host = "https://s3.ap-northeast-1.amazonaws.com/mymyproject" config.fog_directory = 'mymyproject' # 作成したバケット名を記述 config.storage :fog end

.env▽(***にはしっかりキーを入れています)

AWS_ACCESS_KEY_ID =**** AWS_SECRET_ACCESS_KEY =** AWS_BUCKET=mymyproject

使い方

ENV['AWS_ACCESS_KEY_ID']

ENV['AWS_SECRET_ACCESS_KEY']


gemfile▽

source "https://rubygems.org"

Bundle edge Rails instead: gem "rails", github: "rails/rails", branch: "main"

gem "rails", "~> 7.2.1", ">= 7.2.1.2"

The original asset pipeline for Rails [https://github.com/rails/sprockets-rails]

gem "sprockets-rails"

Use postgresql as the database for Active Record

gem "pg", "~> 1.1"

Use the Puma web server [https://github.com/puma/puma]

gem "puma", ">= 5.0"

Bundle and transpile JavaScript [https://github.com/rails/jsbundling-rails]

gem "jsbundling-rails"

Hotwire's SPA-like page accelerator [https://turbo.hotwired.dev]

gem "turbo-rails"

Hotwire's modest JavaScript framework [https://stimulus.hotwired.dev]

gem "stimulus-rails"

Bundle and process CSS [https://github.com/rails/cssbundling-rails]

gem "cssbundling-rails"

Build JSON APIs with ease [https://github.com/rails/jbuilder]

gem "jbuilder"

Use Redis adapter to run Action Cable in production

gem "redis", ">= 4.0.1"

Use Kredis to get higher-level data types in Redis [https://github.com/rails/kredis]

gem "kredis"

Use Active Model has_secure_password [https://guides.rubyonrails.org/active_model_basics.html#securepassword]

gem "bcrypt", "~> 3.1.7"

Windows does not include zoneinfo files, so bundle the tzinfo-data gem

gem "tzinfo-data", platforms: %i[ windows jruby ]

Reduces boot times through caching; required in config/boot.rb

gem "bootsnap", require: false

Use Active Storage variants [https://guides.rubyonrails.org/active_storage_overview.html#transforming-images]

gem "image_processing", "~> 1.2"

gem 'sorcery', '0.17.0' # 認証機能

group :development, :test do

See https://guides.rubyonrails.org/debugging_rails_applications.html#debugging-with-the-debug-gem

gem "debug", platforms: %i[ mri windows ], require: "debug/prelude"

Static analysis for security vulnerabilities [https://brakemanscanner.org/]

gem "brakeman", require: false

Omakase Ruby styling [https://github.com/rails/rubocop-rails-omakase/]

gem "rubocop-rails-omakase", require: false end

group :development do

Use console on exceptions pages [https://github.com/rails/web-console]

gem "web-console" end

group :test do

Use system testing [https://guides.rubyonrails.org/testing.html#system-testing]

gem "capybara" gem "selenium-webdriver" end

ruby '3.2.3'

gem 'carrierwave', '2.2.2' # 画像アップロード

gem 'fog-aws' # S3への画像アップロード★★★

gem 'dotenv-rails' # 環境変数

gemfile.lock▽ (必要そうなところだけ抜粋しています)

dotenv (3.1.4) dotenv-rails (3.1.4) dotenv (= 3.1.4) railties (>= 6.1) drb (2.2.1) erubi (1.13.0) excon (1.2.0)  fog-aws (3.29.0) base64 (~> 0.2.0) fog-core (~> 2.6) fog-json (~> 1.1) fog-xml (~> 0.1) fog-core (2.6.0) builder excon (~> 1.0) formatador (>= 0.2, < 2.0) mime-types fog-json (1.2.0) fog-core multi_json (~> 1.10) fog-xml (0.1.4) fog-core nokogiri (>= 1.5.11, < 2.0.0) formatador (1.1.0) mime-types (3.6.0) logger mime-types-data (~> 3.2015) mime-types-data (3.2024.1105) mini_magick (4.13.2) mini_mime (1.1.5) minitest (5.25.1) msgpack (1.7.3) multi_json (1.15.0) DEPENDENCIES bootsnap brakeman capybara carrierwave (= 2.2.2) cssbundling-rails debug dotenv-rails fog-aws jbuilder


` ※現状のコードの状態がわかるURLでコードを共有したうえで自分でどこがどのように関係していると考えているかなどの説明を記載してください

> 
> ## 検証した結果から分かったこと・考えたこと
> ※手を動かしたり、検証を行って何がわかったか、どんなことが推測できるかを記載してください
> 
>app/uploders/good_image_uploder.rbのファイル設定を# storage :file storage :fogにした瞬間やはりエラーになります・・・ご助言をいただきたいです。よろしくお願いします。
![image](https://github.com/user-attachments/assets/f0a20cb4-c04b-4884-8cbe-ceac357194df)
HIGASHI-SHIHO-54B commented 1 week ago

回答ありがとうございます。 ご指摘いただいたよう、公式をしっかり見て変更を行いました。しかし image 上記のエラーは変わらなかったです。

下記変更した部分です。 config/initializizers/carrierwave ▽

CarrierWave.configure do |config|
 config.fog_credentials = {
  provider: 'AWS',
  aws_access_key_id: ENV['AWS_ACCESS_KEY_ID'], # 環境変数
  aws_secret_access_key: ENV['AWS_SECRET_ACCESS_KEY'], # 環境変数
  use_iam_profile:        true,
  region: 'ap-northeast-1',   # アジアパシフィック(東京)を選択した場合
  host: 's3-ap-northeast-1.amazonaws.com',  # S3のリージョンに合わせる
  endpoint:              'https://s3-ap-northeast-1.amazonaws.com' # 追加
 }
 config.fog_directory  = 'mymyproject' # 作成したバケット名を記述
 config.fog_public     = false
 config.fog_attributes = { cache_control: "public, max-age=#{365.days.to_i}" }
end 

また、公式に s3:ListBucket s3:PutObject s3:GetObject s3:DeleteObject s3:PutObjectAcl 上記5つのポリシーをIAMポリシーに追加してとあったのでそちらも追加しております。 image image

HIGASHI-SHIHO-54B commented 1 week ago
docker compose up
[+] Running 3/2
 ✔ Network my-my-project_default  Created                                                                                                              0.0s 
 ✔ Container my-my-project-db-1   Created                                                                                                              0.0s 
 ✔ Container my-my-project-web-1  Created                                                                                                              0.0s 
Attaching to db-1, web-1
db-1   | The files belonging to this database system will be owned by user "postgres".
db-1   | This user must also own the server process.
db-1   | 
db-1   | The database cluster will be initialized with locale "en_US.utf8".
db-1   | The default database encoding has accordingly been set to "UTF8".
db-1   | The default text search configuration will be set to "english".
db-1   | 
db-1   | Data page checksums are disabled.
db-1   | 
db-1   | fixing permissions on existing directory /var/lib/postgresql/data ... ok
db-1   | creating subdirectories ... ok
db-1   | selecting dynamic shared memory implementation ... posix
db-1   | selecting default max_connections ... 100
db-1   | selecting default shared_buffers ... 128MB
db-1   | selecting default time zone ... Asia/Tokyo
db-1   | creating configuration files ... ok
db-1   | running bootstrap script ... ok
db-1   | performing post-bootstrap initialization ... ok
db-1   | syncing data to disk ... ok
db-1   | 
db-1   | 
db-1   | Success. You can now start the database server using:
db-1   | 
db-1   |     pg_ctl -D /var/lib/postgresql/data -l logfile start
db-1   | 
db-1   | initdb: warning: enabling "trust" authentication for local connections
db-1   | initdb: hint: You can change this by editing pg_hba.conf or using the option -A, or --auth-local and --auth-host, the next time you run initdb.
db-1   | waiting for server to start....2024-11-11 13:30:29.886 JST [48] LOG:  starting PostgreSQL 16.4 (Debian 16.4-1.pgdg120+1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 12.2.0-14) 12.2.0, 64-bit
db-1   | 2024-11-11 13:30:29.887 JST [48] LOG:  listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
db-1   | 2024-11-11 13:30:29.892 JST [51] LOG:  database system was shut down at 2024-11-11 13:30:29 JST
db-1   | 2024-11-11 13:30:29.895 JST [48] LOG:  database system is ready to accept connections
db-1   |  done
db-1   | server started
db-1   | 
db-1   | /usr/local/bin/docker-entrypoint.sh: ignoring /docker-entrypoint-initdb.d/*
db-1   | 
db-1   | waiting for server to shut down....2024-11-11 13:30:30.000 JST [48] LOG:  received fast shutdown request
db-1   | 2024-11-11 13:30:30.001 JST [48] LOG:  aborting any active transactions
db-1   | 2024-11-11 13:30:30.002 JST [48] LOG:  background worker "logical replication launcher" (PID 54) exited with exit code 1
db-1   | 2024-11-11 13:30:30.002 JST [49] LOG:  shutting down
db-1   | 2024-11-11 13:30:30.003 JST [49] LOG:  checkpoint starting: shutdown immediate
db-1   | 2024-11-11 13:30:30.010 JST [49] LOG:  checkpoint complete: wrote 3 buffers (0.0%); 0 WAL file(s) added, 0 removed, 0 recycled; write=0.003 s, sync=0.001 s, total=0.008 s; sync files=2, longest=0.001 s, average=0.001 s; distance=0 kB, estimate=0 kB; lsn=0/14EA2C8, redo lsn=0/14EA2C8
db-1   | 2024-11-11 13:30:30.013 JST [48] LOG:  database system is shut down
db-1   |  done
db-1   | server stopped
db-1   | 
db-1   | PostgreSQL init process complete; ready for start up.
db-1   | 
db-1   | 2024-11-11 13:30:30.116 JST [1] LOG:  starting PostgreSQL 16.4 (Debian 16.4-1.pgdg120+1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 12.2.0-14) 12.2.0, 64-bit
db-1   | 2024-11-11 13:30:30.116 JST [1] LOG:  listening on IPv4 address "0.0.0.0", port 5432
db-1   | 2024-11-11 13:30:30.116 JST [1] LOG:  listening on IPv6 address "::", port 5432
db-1   | 2024-11-11 13:30:30.121 JST [1] LOG:  listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
db-1   | 2024-11-11 13:30:30.125 JST [62] LOG:  database system was shut down at 2024-11-11 13:30:29 JST
db-1   | 2024-11-11 13:30:30.128 JST [1] LOG:  database system is ready to accept connections
db-1   | 2024-11-11 13:30:39.378 JST [73] FATAL:  database "myapp_development" does not exist
web-1  | Bundle complete! 21 Gemfile dependencies, 130 gems now installed.
web-1  | Use `bundle info [gemname]` to see where a bundled gem is installed.
db-1   | 2024-11-11 13:30:41.298 JST [74] FATAL:  database "myapp_development" does not exist
web-1  | Created database 'myapp_development'
db-1   | 2024-11-11 13:30:41.464 JST [77] FATAL:  database "myapp_test" does not exist
web-1  | Created database 'myapp_test'
web-1  | WARN: Unresolved or ambiguous specs during Gem::Specification.reset:
web-1  |       stringio (>= 0)
web-1  |       Available/installed versions of this gem:
web-1  |       - 3.1.2
web-1  |       - 3.1.1
web-1  |       - 3.0.4
web-1  | WARN: Clearing out unresolved specs. Try 'gem cleanup <gem>'
web-1  | Please report a bug if this causes problems.
web-1  | 13:30:41 web.1  | started with pid 12
web-1  | 13:30:41 js.1   | started with pid 13
web-1  | 13:30:41 css.1  | started with pid 14
web-1  | 13:30:42 js.1   | yarn run v1.22.19
web-1  | 13:30:42 css.1  | yarn run v1.22.19
web-1  | 13:30:42 js.1   | $ esbuild app/javascript/*.* --bundle --sourcemap --format=esm --outdir=app/assets/builds --public-path=/assets --watch
web-1  | 13:30:42 css.1  | $ yarn build:css:compile && yarn build:css:prefix --watch
web-1  | 13:30:42 web.1  | Puma starting in single mode...
web-1  | 13:30:42 web.1  | * Puma version: 6.4.3 (ruby 3.2.3-p157) ("The Eagle of Durango")
web-1  | 13:30:42 web.1  | *  Min threads: 3
web-1  | 13:30:42 web.1  | *  Max threads: 3
web-1  | 13:30:42 web.1  | *  Environment: development
web-1  | 13:30:42 web.1  | *          PID: 12
web-1  | 13:30:42 js.1   | [watch] build finished, watching for changes...
web-1  | 13:30:42 css.1  | $ sass ./app/assets/stylesheets/application.bootstrap.scss:./app/assets/builds/application.css --no-source-map --load-path=node_modules
web-1  | 13:30:42 css.1  | DEPRECATION WARNING: Sass @import rules are deprecated and will be removed in Dart Sass 3.0.0.
web-1  | 13:30:42 css.1  | 
web-1  | 13:30:42 css.1  | More info and automated migrator: https://sass-lang.com/d/import
web-1  | 13:30:42 css.1  | 
web-1  | 13:30:42 css.1  |   ╷
web-1  | 13:30:42 css.1  | 1 │ @import "mixins/banner";
web-1  | 13:30:42 css.1  |   │         ^^^^^^^^^^^^^^^
web-1  | 13:30:42 css.1  |   ╵
web-1  | 13:30:42 css.1  |     bootstrap/scss/bootstrap.scss 1:9                      @use
web-1  | 13:30:42 css.1  |     app/assets/stylesheets/application.bootstrap.scss 2:1  root stylesheet
web-1  | 13:30:42 css.1  | 
web-1  | 13:30:42 css.1  | DEPRECATION WARNING: Sass @import rules are deprecated and will be removed in Dart Sass 3.0.0.
web-1  | 13:30:42 css.1  | 
web-1  | 13:30:42 css.1  | More info and automated migrator: https://sass-lang.com/d/import
web-1  | 13:30:42 css.1  | 
web-1  | 13:30:42 css.1  |   ╷
web-1  | 13:30:42 css.1  | 7 │ @import "functions";
web-1  | 13:30:42 css.1  |   │         ^^^^^^^^^^^
web-1  | 13:30:42 css.1  |   ╵
web-1  | 13:30:42 css.1  |     bootstrap/scss/bootstrap.scss 7:9                      @use
web-1  | 13:30:42 css.1  |     app/assets/stylesheets/application.bootstrap.scss 2:1  root stylesheet
web-1  | 13:30:42 css.1  | 
web-1  | 13:30:42 css.1  | DEPRECATION WARNING: Sass @import rules are deprecated and will be removed in Dart Sass 3.0.0.
web-1  | 13:30:42 css.1  | 
web-1  | 13:30:42 css.1  | More info and automated migrator: https://sass-lang.com/d/import
web-1  | 13:30:42 css.1  | 
web-1  | 13:30:42 css.1  |   ╷
web-1  | 13:30:42 css.1  | 8 │ @import "variables";
web-1  | 13:30:42 css.1  |   │         ^^^^^^^^^^^
web-1  | 13:30:42 css.1  |   ╵
web-1  | 13:30:42 css.1  |     bootstrap/scss/bootstrap.scss 8:9                      @use
web-1  | 13:30:42 css.1  |     app/assets/stylesheets/application.bootstrap.scss 2:1  root stylesheet
web-1  | 13:30:42 css.1  | 
web-1  | 13:30:42 css.1  | DEPRECATION WARNING: Sass @import rules are deprecated and will be removed in Dart Sass 3.0.0.
web-1  | 13:30:42 css.1  | 
web-1  | 13:30:42 css.1  | More info and automated migrator: https://sass-lang.com/d/import
web-1  | 13:30:42 css.1  | 
web-1  | 13:30:42 css.1  |   ╷
web-1  | 13:30:42 css.1  | 9 │ @import "variables-dark";
web-1  | 13:30:42 css.1  |   │         ^^^^^^^^^^^^^^^^
web-1  | 13:30:42 css.1  |   ╵
web-1  | 13:30:42 css.1  |     bootstrap/scss/bootstrap.scss 9:9                      @use
web-1  | 13:30:42 css.1  |     app/assets/stylesheets/application.bootstrap.scss 2:1  root stylesheet
web-1  | 13:30:42 css.1  | 
web-1  | 13:30:42 css.1  | DEPRECATION WARNING: Sass @import rules are deprecated and will be removed in Dart Sass 3.0.0.
web-1  | 13:30:42 css.1  | 
web-1  | 13:30:42 css.1  | More info and automated migrator: https://sass-lang.com/d/import
web-1  | 13:30:42 css.1  | 
web-1  | 13:30:42 css.1  |    ╷
web-1  | 13:30:42 css.1  | 10 │ @import "maps";
web-1  | 13:30:42 css.1  |    │         ^^^^^^
web-1  | 13:30:42 css.1  |    ╵
web-1  | 13:30:42 css.1  |     bootstrap/scss/bootstrap.scss 10:9                     @use
web-1  | 13:30:42 css.1  |     app/assets/stylesheets/application.bootstrap.scss 2:1  root stylesheet
web-1  | 13:30:42 css.1  | 
web-1  | 13:30:42 css.1  | DEPRECATION WARNING: Global built-in functions are deprecated and will be removed in Dart Sass 3.0.0.
web-1  | 13:30:42 css.1  | Use color.mix instead.
web-1  | 13:30:42 css.1  | 
web-1  | 13:30:42 css.1  | More info and automated migrator: https://sass-lang.com/d/import
web-1  | 13:30:42 css.1  | 
web-1  | 13:30:42 css.1  |     ╷
web-1  | 13:30:42 css.1  | 207 │   @return mix(white, $color, $weight);
web-1  | 13:30:42 css.1  |     │           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
web-1  | 13:30:42 css.1  |     ╵
web-1  | 13:30:42 css.1  |     node_modules/bootstrap/scss/_functions.scss 207:11     tint-color()
web-1  | 13:30:42 css.1  |     node_modules/bootstrap/scss/_variables.scss 79:12      @import
web-1  | 13:30:42 css.1  |     bootstrap/scss/bootstrap.scss 8:9                      @use
web-1  | 13:30:42 css.1  |     app/assets/stylesheets/application.bootstrap.scss 2:1  root stylesheet
web-1  | 13:30:42 css.1  | 
web-1  | 13:30:42 css.1  | DEPRECATION WARNING: Global built-in functions are deprecated and will be removed in Dart Sass 3.0.0.
web-1  | 13:30:42 css.1  | Use color.mix instead.
web-1  | 13:30:42 css.1  | 
web-1  | 13:30:42 css.1  | More info and automated migrator: https://sass-lang.com/d/import
web-1  | 13:30:42 css.1  | 
web-1  | 13:30:42 css.1  |     ╷
web-1  | 13:30:42 css.1  | 212 │   @return mix(black, $color, $weight);
web-1  | 13:30:42 css.1  |     │           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
web-1  | 13:30:42 css.1  |     ╵
web-1  | 13:30:42 css.1  |     node_modules/bootstrap/scss/_functions.scss 212:11     shade-color()
web-1  | 13:30:42 css.1  |     node_modules/bootstrap/scss/_variables.scss 84:12      @import
web-1  | 13:30:42 css.1  |     bootstrap/scss/bootstrap.scss 8:9                      @use
web-1  | 13:30:42 css.1  |     app/assets/stylesheets/application.bootstrap.scss 2:1  root stylesheet
web-1  | 13:30:42 css.1  | 
web-1  | 13:30:42 css.1  | DEPRECATION WARNING: Global built-in functions are deprecated and will be removed in Dart Sass 3.0.0.
web-1  | 13:30:42 css.1  | Use color.mix instead.
web-1  | 13:30:42 css.1  | 
web-1  | 13:30:42 css.1  | More info and automated migrator: https://sass-lang.com/d/import
web-1  | 13:30:42 css.1  | 
web-1  | 13:30:42 css.1  |     ╷
web-1  | 13:30:42 css.1  | 342 │ $light-bg-subtle:         mix($gray-100, $white) !default;
web-1  | 13:30:42 css.1  |     │                           ^^^^^^^^^^^^^^^^^^^^^^
web-1  | 13:30:42 css.1  |     ╵
web-1  | 13:30:42 css.1  |     node_modules/bootstrap/scss/_variables.scss 342:27     @import
web-1  | 13:30:42 css.1  |     bootstrap/scss/bootstrap.scss 8:9                      @use
web-1  | 13:30:42 css.1  |     app/assets/stylesheets/application.bootstrap.scss 2:1  root stylesheet
web-1  | 13:30:42 css.1  | 
web-1  | 13:30:42 css.1  | DEPRECATION WARNING: Global built-in functions are deprecated and will be removed in Dart Sass 3.0.0.
web-1  | 13:30:42 css.1  | Use math.unit instead.
web-1  | 13:30:42 css.1  | 
web-1  | 13:30:42 css.1  | More info and automated migrator: https://sass-lang.com/d/import
web-1  | 13:30:42 css.1  | 
web-1  | 13:30:42 css.1  |    ╷
web-1  | 13:30:42 css.1  | 11 │     @if $prev-num == null or unit($num) == "%" or unit($prev-num) == "%" {
web-1  | 13:30:42 css.1  |    │                              ^^^^^^^^^^
web-1  | 13:30:42 css.1  |    ╵
web-1  | 13:30:42 css.1  |     node_modules/bootstrap/scss/_functions.scss 11:30      -assert-ascending()
web-1  | 13:30:42 web.1  | * Listening on http://0.0.0.0:3000
web-1  | 13:30:42 css.1  |     node_modules/bootstrap/scss/_variables.scss 494:1      @import
web-1  | 13:30:42 css.1  |     bootstrap/scss/bootstrap.scss 8:9                      @use
web-1  | 13:30:42 css.1  |     app/assets/stylesheets/application.bootstrap.scss 2:1  root stylesheet
web-1  | 13:30:42 css.1  | 
web-1  | 13:30:42 css.1  | DEPRECATION WARNING: Global built-in functions are deprecated and will be removed in Dart Sass 3.0.0.
web-1  | 13:30:42 css.1  | Use math.unit instead.
web-1  | 13:30:42 css.1  | 
web-1  | 13:30:42 css.1  | More info and automated migrator: https://sass-lang.com/d/import
web-1  | 13:30:42 css.1  | 
web-1  | 13:30:42 css.1  |    ╷
web-1  | 13:30:42 css.1  | 11 │     @if $prev-num == null or unit($num) == "%" or unit($prev-num) == "%" {
web-1  | 13:30:42 css.1  |    │                                                   ^^^^^^^^^^^^^^^
web-1  | 13:30:42 css.1  |    ╵
web-1  | 13:30:42 css.1  |     node_modules/bootstrap/scss/_functions.scss 11:51      -assert-ascending()
web-1  | 13:30:42 css.1  |     node_modules/bootstrap/scss/_variables.scss 494:1      @import
web-1  | 13:30:42 css.1  |     bootstrap/scss/bootstrap.scss 8:9                      @use
web-1  | 13:30:42 css.1  |     app/assets/stylesheets/application.bootstrap.scss 2:1  root stylesheet
web-1  | 13:30:42 css.1  | 
web-1  | 13:30:42 web.1  | Use Ctrl-C to stop
web-1  | 13:30:42 css.1  | DEPRECATION WARNING: red() is deprecated. Suggestion:
web-1  | 13:30:42 css.1  | 
web-1  | 13:30:42 css.1  | color.channel($color, "red", $space: rgb)
web-1  | 13:30:42 css.1  | 
web-1  | 13:30:42 css.1  | More info: https://sass-lang.com/d/color-functions
web-1  | 13:30:42 css.1  | 
web-1  | 13:30:42 css.1  |     ╷
web-1  | 13:30:42 css.1  | 185 │     "r": red($color),
web-1  | 13:30:42 css.1  |     │          ^^^^^^^^^^^
web-1  | 13:30:42 css.1  |     ╵
web-1  | 13:30:42 css.1  |     node_modules/bootstrap/scss/_functions.scss 185:10     luminance()
web-1  | 13:30:42 css.1  |     node_modules/bootstrap/scss/_functions.scss 174:8      contrast-ratio()
web-1  | 13:30:42 css.1  |     node_modules/bootstrap/scss/_functions.scss 159:22     color-contrast()
web-1  | 13:30:42 css.1  |     node_modules/bootstrap/scss/_variables.scss 846:42     @import
web-1  | 13:30:42 css.1  |     bootstrap/scss/bootstrap.scss 8:9                      @use
web-1  | 13:30:42 css.1  |     app/assets/stylesheets/application.bootstrap.scss 2:1  root stylesheet
web-1  | 13:30:42 css.1  | 
web-1  | 13:30:42 css.1  | DEPRECATION WARNING: green() is deprecated. Suggestion:
web-1  | 13:30:42 css.1  | 
web-1  | 13:30:42 css.1  | color.channel($color, "green", $space: rgb)
web-1  | 13:30:42 css.1  | 
web-1  | 13:30:42 css.1  | More info: https://sass-lang.com/d/color-functions
web-1  | 13:30:42 css.1  | 
web-1  | 13:30:42 css.1  |     ╷
web-1  | 13:30:42 css.1  | 186 │     "g": green($color),
web-1  | 13:30:42 css.1  |     │          ^^^^^^^^^^^^^
web-1  | 13:30:42 css.1  |     ╵
web-1  | 13:30:42 css.1  |     node_modules/bootstrap/scss/_functions.scss 186:10     luminance()
web-1  | 13:30:42 css.1  |     node_modules/bootstrap/scss/_functions.scss 174:8      contrast-ratio()
web-1  | 13:30:42 css.1  |     node_modules/bootstrap/scss/_functions.scss 159:22     color-contrast()
web-1  | 13:30:42 css.1  |     node_modules/bootstrap/scss/_variables.scss 846:42     @import
web-1  | 13:30:42 css.1  |     bootstrap/scss/bootstrap.scss 8:9                      @use
web-1  | 13:30:42 css.1  |     app/assets/stylesheets/application.bootstrap.scss 2:1  root stylesheet
web-1  | 13:30:42 css.1  | 
web-1  | 13:30:42 css.1  | DEPRECATION WARNING: blue() is deprecated. Suggestion:
web-1  | 13:30:42 css.1  | 
web-1  | 13:30:42 css.1  | color.channel($color, "blue", $space: rgb)
web-1  | 13:30:42 css.1  | 
web-1  | 13:30:42 css.1  | More info: https://sass-lang.com/d/color-functions
web-1  | 13:30:42 css.1  | 
web-1  | 13:30:42 css.1  |     ╷
web-1  | 13:30:42 css.1  | 187 │     "b": blue($color)
web-1  | 13:30:42 css.1  |     │          ^^^^^^^^^^^^
web-1  | 13:30:42 css.1  |     ╵
web-1  | 13:30:42 css.1  |     node_modules/bootstrap/scss/_functions.scss 187:10     luminance()
web-1  | 13:30:42 css.1  |     node_modules/bootstrap/scss/_functions.scss 174:8      contrast-ratio()
web-1  | 13:30:42 css.1  |     node_modules/bootstrap/scss/_functions.scss 159:22     color-contrast()
web-1  | 13:30:42 css.1  |     node_modules/bootstrap/scss/_variables.scss 846:42     @import
web-1  | 13:30:42 css.1  |     bootstrap/scss/bootstrap.scss 8:9                      @use
web-1  | 13:30:42 css.1  |     app/assets/stylesheets/application.bootstrap.scss 2:1  root stylesheet
web-1  | 13:30:42 css.1  | 
web-1  | 13:30:42 css.1  | DEPRECATION WARNING: red() is deprecated. Suggestion:
web-1  | 13:30:42 css.1  | 
web-1  | 13:30:42 css.1  | color.channel($color, "red", $space: rgb)
web-1  | 13:30:42 css.1  | 
web-1  | 13:30:42 css.1  | More info: https://sass-lang.com/d/color-functions
web-1  | 13:30:42 css.1  | 
web-1  | 13:30:42 css.1  |    ╷
web-1  | 13:30:42 css.1  | 37 │   @return red($value), green($value), blue($value);
web-1  | 13:30:42 css.1  |    │           ^^^^^^^^^^^
web-1  | 13:30:42 css.1  |    ╵
web-1  | 13:30:42 css.1  |     node_modules/bootstrap/scss/_functions.scss 37:11      to-rgb()
web-1  | 13:30:42 css.1  |     node_modules/bootstrap/scss/_variables.scss 846:31     @import
web-1  | 13:30:42 css.1  |     bootstrap/scss/bootstrap.scss 8:9                      @use
web-1  | 13:30:42 css.1  |     app/assets/stylesheets/application.bootstrap.scss 2:1  root stylesheet
web-1  | 13:30:42 css.1  | 
web-1  | 13:30:42 css.1  | DEPRECATION WARNING: green() is deprecated. Suggestion:
web-1  | 13:30:42 css.1  | 
web-1  | 13:30:42 css.1  | color.channel($color, "green", $space: rgb)
web-1  | 13:30:42 css.1  | 
web-1  | 13:30:42 css.1  | More info: https://sass-lang.com/d/color-functions
web-1  | 13:30:42 css.1  | 
web-1  | 13:30:42 css.1  |    ╷
web-1  | 13:30:42 css.1  | 37 │   @return red($value), green($value), blue($value);
web-1  | 13:30:42 css.1  |    │                        ^^^^^^^^^^^^^
web-1  | 13:30:42 css.1  |    ╵
web-1  | 13:30:42 css.1  |     node_modules/bootstrap/scss/_functions.scss 37:24      to-rgb()
web-1  | 13:30:42 css.1  |     node_modules/bootstrap/scss/_variables.scss 846:31     @import
web-1  | 13:30:42 css.1  |     bootstrap/scss/bootstrap.scss 8:9                      @use
web-1  | 13:30:42 css.1  |     app/assets/stylesheets/application.bootstrap.scss 2:1  root stylesheet
web-1  | 13:30:42 css.1  | 
web-1  | 13:30:42 css.1  | DEPRECATION WARNING: Sass's behavior for declarations that appear after nested
web-1  | 13:30:42 css.1  | rules will be changing to match the behavior specified by CSS in an upcoming
web-1  | 13:30:42 css.1  | version. To keep the existing behavior, move the declaration above the nested
web-1  | 13:30:42 css.1  | rule. To opt into the new behavior, wrap the declaration in `& {}`.
web-1  | 13:30:42 css.1  | 
web-1  | 13:30:42 css.1  | More info: https://sass-lang.com/d/mixed-decls
web-1  | 13:30:42 css.1  | 
web-1  | 13:30:42 css.1  |     ┌──> node_modules/bootstrap/scss/_reboot.scss
web-1  | 13:30:42 css.1  | 503 │     font-weight: $legend-font-weight;
web-1  | 13:30:42 css.1  |     │     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ declaration
web-1  | 13:30:42 css.1  |     ╵
web-1  | 13:30:42 css.1  |     ┌──> node_modules/bootstrap/scss/vendor/_rfs.scss
web-1  | 13:30:42 css.1  | 136 │ ┌     @media (#{$rfs-mq-property-width}: #{$rfs-mq-value}) {
web-1  | 13:30:42 css.1  | 137 │ │       @content;
web-1  | 13:30:42 css.1  | 138 │ │     }
web-1  | 13:30:42 css.1  |     │ └─── nested rule
web-1  | 13:30:42 css.1  |     ╵
web-1  | 13:30:42 css.1  |     node_modules/bootstrap/scss/_reboot.scss 503:3         @import
web-1  | 13:30:42 css.1  |     bootstrap/scss/bootstrap.scss 16:9                     @use
web-1  | 13:30:42 css.1  |     app/assets/stylesheets/application.bootstrap.scss 2:1  root stylesheet
web-1  | 13:30:42 css.1  | 
web-1  | 13:30:42 css.1  | DEPRECATION WARNING: Sass's behavior for declarations that appear after nested
web-1  | 13:30:42 css.1  | rules will be changing to match the behavior specified by CSS in an upcoming
web-1  | 13:30:42 css.1  | version. To keep the existing behavior, move the declaration above the nested
web-1  | 13:30:42 css.1  | rule. To opt into the new behavior, wrap the declaration in `& {}`.
web-1  | 13:30:42 css.1  | 
web-1  | 13:30:42 css.1  | More info: https://sass-lang.com/d/mixed-decls
web-1  | 13:30:42 css.1  | 
web-1  | 13:30:42 css.1  |     ┌──> node_modules/bootstrap/scss/_reboot.scss
web-1  | 13:30:42 css.1  | 504 │     line-height: inherit;
web-1  | 13:30:42 css.1  |     │     ^^^^^^^^^^^^^^^^^^^^ declaration
web-1  | 13:30:42 css.1  |     ╵
web-1  | 13:30:42 css.1  |     ┌──> node_modules/bootstrap/scss/vendor/_rfs.scss
web-1  | 13:30:42 css.1  | 136 │ ┌     @media (#{$rfs-mq-property-width}: #{$rfs-mq-value}) {
web-1  | 13:30:42 css.1  | 137 │ │       @content;
web-1  | 13:30:42 css.1  | 138 │ │     }
web-1  | 13:30:42 css.1  |     │ └─── nested rule
web-1  | 13:30:42 css.1  |     ╵
web-1  | 13:30:42 css.1  |     node_modules/bootstrap/scss/_reboot.scss 504:3         @import
web-1  | 13:30:42 css.1  |     bootstrap/scss/bootstrap.scss 16:9                     @use
web-1  | 13:30:42 css.1  |     app/assets/stylesheets/application.bootstrap.scss 2:1  root stylesheet
web-1  | 13:30:42 css.1  | 
web-1  | 13:30:42 css.1  | DEPRECATION WARNING: Sass's behavior for declarations that appear after nested
web-1  | 13:30:42 css.1  | rules will be changing to match the behavior specified by CSS in an upcoming
web-1  | 13:30:42 css.1  | version. To keep the existing behavior, move the declaration above the nested
web-1  | 13:30:42 css.1  | rule. To opt into the new behavior, wrap the declaration in `& {}`.
web-1  | 13:30:42 css.1  | 
web-1  | 13:30:42 css.1  | More info: https://sass-lang.com/d/mixed-decls
web-1  | 13:30:42 css.1  | 
web-1  | 13:30:42 css.1  |     ┌──> node_modules/bootstrap/scss/_type.scss
web-1  | 13:30:42 css.1  | 38  │       font-family: $display-font-family;
web-1  | 13:30:42 css.1  |     │       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ declaration
web-1  | 13:30:42 css.1  |     ╵
web-1  | 13:30:42 css.1  |     ┌──> node_modules/bootstrap/scss/vendor/_rfs.scss
web-1  | 13:30:42 css.1  | 136 │ ┌     @media (#{$rfs-mq-property-width}: #{$rfs-mq-value}) {
web-1  | 13:30:42 css.1  | 137 │ │       @content;
web-1  | 13:30:42 css.1  | 138 │ │     }
web-1  | 13:30:42 css.1  |     │ └─── nested rule
web-1  | 13:30:42 css.1  |     ╵
web-1  | 13:30:42 css.1  |     node_modules/bootstrap/scss/_type.scss 38:5            @import
web-1  | 13:30:42 css.1  |     bootstrap/scss/bootstrap.scss 17:9                     @use
web-1  | 13:30:42 css.1  |     app/assets/stylesheets/application.bootstrap.scss 2:1  root stylesheet
web-1  | 13:30:42 css.1  | 
web-1  | 13:30:42 css.1  | DEPRECATION WARNING: Sass's behavior for declarations that appear after nested
web-1  | 13:30:42 css.1  | rules will be changing to match the behavior specified by CSS in an upcoming
web-1  | 13:30:42 css.1  | version. To keep the existing behavior, move the declaration above the nested
web-1  | 13:30:42 css.1  | rule. To opt into the new behavior, wrap the declaration in `& {}`.
web-1  | 13:30:42 css.1  | 
web-1  | 13:30:42 css.1  | More info: https://sass-lang.com/d/mixed-decls
web-1  | 13:30:42 css.1  | 
web-1  | 13:30:42 css.1  |     ┌──> node_modules/bootstrap/scss/_type.scss
web-1  | 13:30:42 css.1  | 39  │       font-style: $display-font-style;
web-1  | 13:30:42 css.1  |     │       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ declaration
web-1  | 13:30:42 css.1  |     ╵
web-1  | 13:30:42 css.1  |     ┌──> node_modules/bootstrap/scss/vendor/_rfs.scss
web-1  | 13:30:42 css.1  | 136 │ ┌     @media (#{$rfs-mq-property-width}: #{$rfs-mq-value}) {
web-1  | 13:30:42 css.1  | 137 │ │       @content;
web-1  | 13:30:42 css.1  | 138 │ │     }
web-1  | 13:30:42 css.1  |     │ └─── nested rule
web-1  | 13:30:42 css.1  |     ╵
web-1  | 13:30:42 css.1  |     node_modules/bootstrap/scss/_type.scss 39:5            @import
web-1  | 13:30:42 css.1  |     bootstrap/scss/bootstrap.scss 17:9                     @use
web-1  | 13:30:42 css.1  |     app/assets/stylesheets/application.bootstrap.scss 2:1  root stylesheet
web-1  | 13:30:42 css.1  | 
web-1  | 13:30:42 css.1  | DEPRECATION WARNING: Sass's behavior for declarations that appear after nested
web-1  | 13:30:42 css.1  | rules will be changing to match the behavior specified by CSS in an upcoming
web-1  | 13:30:42 css.1  | version. To keep the existing behavior, move the declaration above the nested
web-1  | 13:30:42 css.1  | rule. To opt into the new behavior, wrap the declaration in `& {}`.
web-1  | 13:30:42 css.1  | 
web-1  | 13:30:42 css.1  | More info: https://sass-lang.com/d/mixed-decls
web-1  | 13:30:42 css.1  | 
web-1  | 13:30:42 css.1  |     ┌──> node_modules/bootstrap/scss/_type.scss
web-1  | 13:30:42 css.1  | 40  │       font-weight: $display-font-weight;
web-1  | 13:30:42 css.1  |     │       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ declaration
web-1  | 13:30:42 css.1  |     ╵
web-1  | 13:30:42 css.1  |     ┌──> node_modules/bootstrap/scss/vendor/_rfs.scss
web-1  | 13:30:42 css.1  | 136 │ ┌     @media (#{$rfs-mq-property-width}: #{$rfs-mq-value}) {
web-1  | 13:30:42 css.1  | 137 │ │       @content;
web-1  | 13:30:42 css.1  | 138 │ │     }
web-1  | 13:30:42 css.1  |     │ └─── nested rule
web-1  | 13:30:42 css.1  |     ╵
web-1  | 13:30:42 css.1  |     node_modules/bootstrap/scss/_type.scss 40:5            @import
web-1  | 13:30:42 css.1  |     bootstrap/scss/bootstrap.scss 17:9                     @use
web-1  | 13:30:42 css.1  |     app/assets/stylesheets/application.bootstrap.scss 2:1  root stylesheet
web-1  | 13:30:42 css.1  | 
web-1  | 13:30:43 css.1  | WARNING: 254 repetitive deprecation warnings omitted.
web-1  | 13:30:43 css.1  | Run in verbose mode to see all warnings.
web-1  | 13:30:43 css.1  | 
web-1  | 13:30:44 css.1  | $ postcss ./app/assets/builds/application.css --use=autoprefixer --output=./app/assets/builds/application.css --watch
db-1   | 2024-11-11 13:35:30.216 JST [60] LOG:  checkpoint starting: time
db-1   | 2024-11-11 13:38:43.959 JST [60] LOG:  checkpoint complete: wrote 1933 buffers (11.8%); 1 WAL file(s) added, 0 removed, 0 recycled; write=193.582 s, sync=0.107 s, total=193.744 s; sync files=646, longest=0.038 s, average=0.001 s; distance=8947 kB, estimate=8947 kB; lsn=0/1DA6FD8, redo lsn=0/1DA6FA0
web-1  | 06:50:29        | terminated by SIGHUP
web-1  | 06:50:29 system | sending SIGTERM to all processes
web-1  | 06:50:29 web.1  | - Gracefully stopping, waiting for requests to finish
web-1  | 06:50:30 js.1   | exited with code 1
web-1  | 06:50:30 web.1  | terminated by SIGTERM
web-1  | 06:50:30 css.1  | exited with code 1
web-1 exited with code 1

app/uploders/good_image_uploder.rbをstorage :file →storage :fogへ変更するとログがこのように止まっておりました。ホスト3000をいくら触っても動かないので共有いたします。 データベースが作られていない??ようなことが出ているようですが一度作られていたら大丈夫ですよね?

docker ps
CONTAINER ID   IMAGE               COMMAND                  CREATED          STATUS                    PORTS                    NAMES
6087f3139ae6   my-my-project-web   "bash -c 'bundle ins…"   55 seconds ago   Up 43 seconds             0.0.0.0:3000->3000/tcp   my-my-project-web-1
570283596e02   postgres            "docker-entrypoint.s…"   55 seconds ago   Up 54 seconds (healthy)   0.0.0.0:5432->5432/tcp   my-my-project-db-1

★★storage :file →storage :fog後★★
docker ps
CONTAINER ID   IMAGE      COMMAND                  CREATED        STATUS                  PORTS                    NAMES
91f9e5bc1df8   postgres   "docker-entrypoint.s…"   18 hours ago   Up 18 hours (healthy)   0.0.0.0:5432->5432/tcp   my-my-project-db-1
HIGASHI-SHIHO-54B commented 1 week ago

gemfile▽

gem 'carrierwave', '~> 3.0' # 画像アップロード

gem 'fog-aws' # S3への画像アップロード

gem 'dotenv-rails' # 環境変数

上記でbundle installしdocker compose restartも行っておりますがエラーに変わりがありません。 gemfile.lock▽

 ffi (1.17.0-x86_64-linux-gnu)
    fog-aws (3.29.0)
      base64 (~> 0.2.0)
      fog-core (~> 2.6)
      fog-json (~> 1.1)
      fog-xml (~> 0.1)
    fog-core (2.6.0)
      builder
      excon (~> 1.0)
      formatador (>= 0.2, < 2.0)
      mime-types
    fog-json (1.2.0)
      fog-core
      multi_json (~> 1.10)
    fog-xml (0.1.4)
      fog-core
      nokogiri (>= 1.5.11, < 2.0.0)
    formatador (1.1.0)

DEPENDENCIES
  bootsnap
  brakeman
  capybara
  carrierwave (~> 3.0)
  cssbundling-rails
  debug
  dotenv-rails
  fog-aws
  jbuilder
  jsbundling-rails
  pg (~> 1.1)
  puma (>= 5.0)
  rails (~> 7.2.1, >= 7.2.1.2)
  rubocop-rails-omakase
  selenium-webdriver
  sorcery (= 0.17.0)
  sprockets-rails
  stimulus-rails
  turbo-rails
  tzinfo-data
  web-console
HIGASHI-SHIHO-54B commented 1 week ago

config/initializizers/carrierwave ▽

CarrierWave.configure do |config|
 config.fog_credentials = {
  provider: 'AWS',
  aws_access_key_id: ENV['AWS_ACCESS_KEY_ID'], # 環境変数
  aws_secret_access_key: ENV['AWS_SECRET_ACCESS_KEY'], # 環境変数
  region: 'ap-northeast-1' # リージョン
  host: 's3-ap-northeast-1.amazonaws.com' # ホスト
  endpoint: 'https://s3-ap-northeast-1.amazonaws.com' # エンドポイント
 }
 config.fog_directory  =  ENV['AWS_S3_BUCKET'] # 環境変数
 config.fog_public    = false
 config.fog_attributes = { cache_control: "public, max-age=#{365.days.to_i}" } # optional, defaults to {}
end 

上記のように変更しても変わりませんでしたが一旦パソコンをシャットダウンしてみたら image

image 上記のようにホスト3000ではs3へ投稿できるようになっていました!!ありがとうございます!! しかし

web-1  | 06:45:12 web.1  | [fog][WARNING] Unable to fetch credentials: Expected(200) <=> Actual(403 Forbidden)
web-1  | 06:45:12 web.1  | 
web-1  | 06:45:12 web.1  | [fog][WARNING] Unable to fetch credentials: Expected(200) <=> Actual(403 Forbidden)
web-1  | 06:45:12 web.1  | 

とエラーがでており、AWSの認証情報が正しく設定されていないか、アクセス権限が不足していることを示しているようでした。一旦このままデプロイしてみましたら、やはり本番では保存されていませんでした。(一時的には表示されていても時間がたったら消える。)開発環境と本番の画像の登録場所を変更している記述はしておりません。どちらもs3になるようにしています。 https://repost.aws/ja/knowledge-center/s3-troubleshoot-403 上記サイトを参考にしつつ確認しますが言っている内容があまり理解できず間違っているところがわかりません。すみませんが確認の仕方を教えていただきたいです。

環境変数の確認→OK IAMポリシーの確認→

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Sid": "VisualEditor0",
            "Effect": "Allow",
            "Action": "s3:ListBucket",
            "Resource": "arn:aws:s3:::mymyproject"
        },
        {
            "Sid": "VisualEditor1",
            "Effect": "Allow",
            "Action": [
                "s3:PutObject",
                "s3:GetObject",
                "s3:DeleteObject",
                "s3:PutObjectAcl"
            ],
            "Resource": "arn:aws:s3:::mymyproject/*"
        }
    ]
}

image image

kenchasonakai commented 1 week ago

アクセス権限が不足していることを示しているようでした。

ローカル環境ではS3にアクセス出来ていて、本番環境でアクセスできないということなので、本番環境に環境変数'AWS_ACCESS_KEY_ID']などが渡せているか確認してみるとよいかと思います