質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.48%
Cloud9

Cloud9は、クラウドからのプログラミングが可能になるWebサービス。IDEとしての機能が搭載されており、GitHubやHerokuなど他ツールとの連携も可能です。ブラウザ上で動くため、デバイスに関係なく開発環境を準備できます。

Ruby

Rubyはプログラミング言語のひとつで、オープンソース、オブジェクト指向のプログラミング開発に対応しています。

Ruby on Rails

Ruby on Railsは、オープンソースのWebアプリケーションフレームワークです。「同じことを繰り返さない」というRailsの基本理念のもと、他のフレームワークより少ないコードで簡単に開発できるよう設計されています。

Q&A

0回答

909閲覧

Railsで送信メールのプレビューが表示されない(Oops VFS connection does not exist)

takuma_lol

総合スコア0

Cloud9

Cloud9は、クラウドからのプログラミングが可能になるWebサービス。IDEとしての機能が搭載されており、GitHubやHerokuなど他ツールとの連携も可能です。ブラウザ上で動くため、デバイスに関係なく開発環境を準備できます。

Ruby

Rubyはプログラミング言語のひとつで、オープンソース、オブジェクト指向のプログラミング開発に対応しています。

Ruby on Rails

Ruby on Railsは、オープンソースのWebアプリケーションフレームワークです。「同じことを繰り返さない」というRailsの基本理念のもと、他のフレームワークより少ないコードで簡単に開発できるよう設計されています。

0グッド

0クリップ

投稿2021/05/14 04:40

前提・実現したいこと

Railsチュートリアル11章に取り組んでいます。
ユーザー有効化のために送信するメールのプレビューを確認する手順を実行しているのですが、railsチュートリアルの通りに行うと
Oops VFS connection does not existのエラーが表示され、プレビューを見ることができません。

具体的な実行手順としては、ブラウザ(Chrome)で
http://0de9d6ccd487419b81d15d70272ccf53.vfs.cloud9.us-east-2.amazonaws.com/rails/mailers/user_mailer/account_activation
を入力しています。

なお、rails sでアプリケーション自体のプレビューは問題なく表示されております
(https://0de9d6ccd487419b81d15d70272ccf53.vfs.cloud9.us-east-2.amazonaws.com
こちらがそのプレビューを表示した際のアドレスです)。

ソースコードと試したことは下述いたします。

程度の低い質問でしたら大変申し訳ございません。
また、必要な情報等の不足がございましたら、お手数ですがコメントをいただければ随時追記いたします。

よろしくお願いいたします。

該当のソースコード

ruby

1(development.rb) 2Rails.application.configure do 3 # Settings specified here will take precedence over those in config/application.rb. 4 5 # In the development environment your application's code is reloaded on 6 # every request. This slows down response time but is perfect for development 7 # since you don't have to restart the web server when you make code changes. 8 config.cache_classes = false 9 10 # Do not eager load code on boot. 11 config.eager_load = false 12 13 # Show full error reports. 14 config.consider_all_requests_local = true 15 16 # Enable/disable caching. By default caching is disabled. 17 # Run rails dev:cache to toggle caching. 18 if Rails.root.join('tmp', 'caching-dev.txt').exist? 19 config.action_controller.perform_caching = true 20 config.action_controller.enable_fragment_cache_logging = true 21 22 config.cache_store = :memory_store 23 config.public_file_server.headers = { 24 'Cache-Control' => "public, max-age=#{2.days.to_i}" 25 } 26 else 27 config.action_controller.perform_caching = false 28 29 config.cache_store = :null_store 30 end 31 32 # Store uploaded files on the local file system (see config/storage.yml for options). 33 config.active_storage.service = :local 34 35 # Don't care if the mailer can't send. 36 config.action_mailer.raise_delivery_errors = false 37 38 host = '0de9d6ccd487419b81d15d70272ccf53.vfs.cloud9.us-east-2.amazonaws.com' ## ここをコピペすると失敗します。自分の環境のホストに変えてください。 39 # クラウドIDEの場合は以下をお使いください 40 config.action_mailer.default_url_options = { host: host, protocol: 'https' } 41 # localhostで開発している場合は以下をお使いください 42 # config.action_mailer.default_url_options = { host: host, protocol: 'http' } 43 44 config.action_mailer.perform_caching = false 45 46 # Print deprecation notices to the Rails logger. 47 config.active_support.deprecation = :log 48 49 # Raise an error on page load if there are pending migrations. 50 config.active_record.migration_error = :page_load 51 52 # Highlight code that triggered database queries in logs. 53 config.active_record.verbose_query_logs = true 54 55 # Debug mode disables concatenation and preprocessing of assets. 56 # This option may cause significant delays in view rendering with a large 57 # number of complex assets. 58 config.assets.debug = true 59 60 # Suppress logger output for asset requests. 61 config.assets.quiet = true 62 63 # Raises error for missing translations. 64 # config.action_view.raise_on_missing_translations = true 65 66 # Use an evented file watcher to asynchronously detect changes in source code, 67 # routes, locales, etc. This feature depends on the listen gem. 68 config.file_watcher = ActiveSupport::EventedFileUpdateChecker 69 70 # Cloud9 への接続を許可する 71 config.hosts.clear 72end 73 74

ruby

1(user_mailer_preview.rb) 2# Preview all emails at http://localhost:3000/rails/mailers/user_mailer 3class UserMailerPreview < ActionMailer::Preview 4 5 # Preview this email at http://localhost:3000/rails/mailers/user_mailer/account_activation 6 def account_activation 7 user = User.first 8 user.activation_token = User.new_token 9 UserMailer.account_activation(user) 10 end 11 # Preview this email at http://localhost:3000/rails/mailers/user_mailer/password_reset 12 def password_reset 13 UserMailer.password_reset 14 end 15 16end 17 18

ruby

1(user_mailer.rb) 2class UserMailer < ApplicationMailer 3 4 # Subject can be set in your I18n file at config/locales/en.yml 5 # with the following lookup: 6 # 7 # en.user_mailer.account_activation.subject 8 # 9 def account_activation(user) 10 @user = user 11 mail to: user.email, subject: "Account activation" 12 end 13 14 # Subject can be set in your I18n file at config/locales/en.yml 15 # with the following lookup: 16 # 17 # en.user_mailer.password_reset.subject 18 # 19 def password_reset 20 @greeting = "Hi" 21 22 mail to: "to@example.org" 23 end 24end 25

試したこと

①AWSのEC2から、当該インスタンスを一旦停止した後、再度立ち上げました。
②ChromeのCookie設定において、Cookieをすべてのサイトに許可するよう設定を変更しました。
③広告ブロッカーの有無を確認しました。そのような機能は使っていないことを確認しました。
④セキュリティソフト(ESET)を使用していたので、Macのアクティビティモニタからプロセスを停止しました。

以上のことを試しましたが、状況に改善は見られませんでした。

補足情報(FW/ツールのバージョンなど)

Rails 6.0.3
Ruby 2.6.3
AWS Cloud9を使用
macOS Mojave(version. 10.14.6)

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

まだ回答がついていません

会員登録して回答してみよう

アカウントをお持ちの方は

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.48%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問