1

I found some SO answers about this problem. I have this error when I load the web from the Docker container.

I tried what's is suggested here

Helper Devise: could not find the `Warden::Proxy` instance on request environment but no success

This is my Dockerfile

FROM ruby:2.4.0
ENV PHANTOM_JS="phantomjs-2.1.1-linux-x86_64"

RUN curl -sL https://deb.nodesource.com/setup_6.x | bash - && \
    curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - && \
    echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list && \
    apt-get update && \
    apt-get upgrade -y && \
    apt-get install -y rake  less rsync locales build-essential chrpath libpq-dev libxml2-dev libxslt1-dev libssl-dev libxft-dev libfreetype6 libfreetype6-dev libfontconfig1 libfontconfig1-dev qt5-default libqt5webkit5-dev gstreamer1.0-plugins-base gstreamer1.0-tools gstreamer1.0-x nodejs yarn pdftk && \
    curl -L -O https://bitbucket.org/ariya/phantomjs/downloads/$PHANTOM_JS.tar.bz2 && \
    tar xvjf $PHANTOM_JS.tar.bz2 && \
    mv $PHANTOM_JS /usr/local/share && \
    ln -sf /usr/local/share/$PHANTOM_JS/bin/phantomjs /usr/local/bin && \
    mkdir -p /root/.phantomjs/2.1.1/x86_64-linux/bin && \
    ln -sf /usr/local/share/$PHANTOM_JS/bin/phantomjs /root/.phantomjs/2.1.1/x86_64-linux/bin/phantomjs && \
    apt-get clean && \
    rm -rf /var/lib/apt/lists/*

RUN sed -i "s/^#\ \+\(en_US.UTF-8\)/\1/" /etc/locale.gen
RUN locale-gen en_US.UTF-8
ENV LANG en_US.UTF-8
ENV LC_ALL en_US.UTF-8
ENV LANGUAGE en_US:en
ENV RAILS_ENV=development
ENV BUNDLE_PATH /box

RUN mkdir /app
WORKDIR /app

COPY Gemfile Gemfile.lock ./
RUN bundle install
COPY package.json ./
RUN yarn install

COPY . .

CMD puma -C config/puma.rb

And I have a docker composer file when I create the image of the database (postgresql) and the image of the rails server.

When all the container are loaded, I go to to my browser and I get this in the terminal:

Error during failsafe response: Devise could not find the Warden::Proxy instance on your request environment. Make sure that your application is loading Devise and Warden as expected and that the Warden::Manager middleware is present in your middleware stack. If you are seeing this on one of your tests, ensure that your tests are either executing the Rails middleware stack or that your tests are using the Devise::Test::ControllerHelpers module to inject the request.env['warden'] object for you.

Note: I'm using Ruby 2.4.0 in local and in Docker

David Luque
  • 1,078
  • 5
  • 18
  • 30

0 Answers0