'How to Resolve Validation failed: Banner Failed to manipulate with MiniMagick, maybe it is not an image? Original Error: `convert /api/tmp/
I’ am working on dockerized RoR project and when I run all tests(RSPEC), I get the following error, related to ImageMagick:
Error:
Failure/Error: article_id { create(:article, :exercise).id }
ActiveRecord::RecordInvalid:
Validation failed: Banner Failed to manipulate with MiniMagick, maybe it is not an image? Original Error: `convert /api/tmp/1652907422-50675578162127-0452-5322/card/test.jpg -auto-orient -resize 500x300^ -gravity Center -background rgba(255,255,255,0.0) -extent 500x300 /tmp/image_processing20220518-356-10emhdm.jpg` failed with error:
convert-im6.q16: insufficient image data in file `/api/tmp/1652907422-50675578162127-0452-5322/card/test.jpg' @ error/jpeg.c/ReadJPEGImage/1117.
The error is related to a FactoryBot, when I need to upload a file:
banner { Rack::Test::UploadedFile.new(File.open("#{Rails.root}/spec/support/images/test.jpg")) }
My Dockerfile:
FROM ruby:2.7.1
RUN 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 -qq && apt-get install -y nodejs build-essential yarn; apt-get clean
RUN mkdir /api
WORKDIR /api
COPY Gemfile Gemfile.lock ./
RUN bundle install
COPY package*.json ./ yarn.lock ./
RUN yarn install
COPY . .
ENTRYPOINT ["./bin/docker-entrypoint.sh"]
Solution 1:[1]
From my perspective the better solution would be to have @Component(from Spring) annotation written at the class level.
package a.b.c;
@Component
public class EnglishDictionary implements Dictionary {
}
package a.b.c;
@Component
public class FrenchDictionary implements Dictionary {
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Udit kaushik |
