Open zachbosteel opened 7 years ago
Having the same issue: invalid or unknown type
error is thrown by Ecto for MyUploader.Type.
** (ArgumentError) invalid or unknown type MyApp.ImageUploader.Type for field :image
lib/ecto/schema.ex:1727: Ecto.Schema.check_type!/3
lib/ecto/schema.ex:1431: Ecto.Schema.__field__/4
lib/accounts/user/user.ex:15: (module)
(stdlib) erl_eval.erl:670: :erl_eval.do_apply/6
So I had this problem tonight and it ended up being that I had the wrong settings in prod for my IAM token so the upload to s3 was failing.
Also here.
Getting this as well. @shawnonthenet can you elaborate on your IAM issue? I only have a single user and key. Works on another dev's machine.
In my case there's something wrong with Imagemagick which cause the conversion step to fail.
Error traced on this line
{:error, ["convert: unable to load module '/usr/local/Cellar/imagemagick/7.0.5-10/lib/ImageMagick//modules-Q16HDRI/coders/jpeg.la': file not found @ error/module.c/OpenModule/1266.\nconvert: no decode delegate for this image format
JPEG' @ error/constitute.c/ReadImage/509.\nconvert: no images defined /var/folders/s3/j8_f62kx4dx8g7j_q5rb3my80000gn/T/EMXOWSUFDBT73REVERBBWH7RQ7KASJQU' @ error/convert.c/ConvertImageCommand/3254.\n", "convert: unable to load module '/usr/local/Cellar/imagemagick/7.0.5-10/lib/ImageMagick//modules-Q16HDRI/coders/jpeg.la': file not found @ error/module.c/OpenModule/1266.\nconvert: no decode delegate for this image format
JPEG' @ error/constitute.c/ReadImage/509.\nconvert: no images defined /var/folders/s3/j8_f62kx4dx8g7j_q5rb3my80000gn/T/33GWBMEKZ4WICVJRMGYKZ3W3DYA3YXET' @ error/convert.c/ConvertImageCommand/3254.\n"]}
Everything back to normal after "brew update imagemagick".
@xfumihiro Thanks!! brew update imagemagick
fixed it.
This should have more visibility. Upgrading Imagemagick
did the trick as @xfumihiro mentioned.
(ArgumentError) invalid or unknown type Golfcoupons.PackageImageUploader.Type for field :image lib/ecto/schema.ex:1886: Ecto.Schema.check_type!/3 lib/ecto/schema.ex:1507: Ecto.Schema.field/4 lib/golfcoupons/golf/package.ex:10: (module) (stdlib) erl_eval.erl:670: :erl_eval.do_apply/6
I have ImageMagik installed on Linux Mint 18.2 (package version 8:6.8.9.9-7ubuntu5.9)
I'm having this problem and I can't make it work.
I've uninstalled and reinstalled imagemagick with homebrew and I still get [image: {"is invalid",
Anyone else with this problem or any other possible solution?
As it said above, upload failure to S3 causes is invalid
error. It is also included in tests: https://github.com/stavro/arc_ecto/blob/d114fe019fcafb7695415bfd9d349e77525baf1f/test/schema_test.exs#L68
So any kind of storage failure will cause is invalid
error.
Why not raise or propagate adequate error? Image itself is fine, it's just some network error.
So I've lost about an hour trying to get a debug to find out why I received is invalid
error. Image was fine (size and type), and my validator passed it. But after cast I received is invalid
anyway.
Errors got swallowed up here: https://github.com/stavro/arc_ecto/blob/master/lib/arc_ecto/type.ex#L20
I put IO.inspect definition.store(args)
in the cast
function and got the error:
[{:http_error, 403,
%{body: "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<Error><Code>RequestTimeTooSkewed</Code><Message>The difference between the request time and the current time is too large.</Message><RequestTime>20180810T132202Z</RequestTime><ServerTime>2018-08-10T13:37:30Z</ServerTime><MaxAllowedSkewMilliseconds>900000</MaxAllowedSkewMilliseconds><RequestId>B78B31447C732471</RequestId><HostId>...</HostId></Error>",
headers: [{"x-amz-request-id", "..."},
{"x-amz-id-2",
"..."},
{"Content-Type", "application/xml"}, {"Transfer-Encoding", "chunked"},
{"Date", "Fri, 10 Aug 2018 13:37:29 GMT"}, {"Server", "AmazonS3"}],
status_code: 403}}]}
So S3
response was very clear (server clocks went out of sync this time), but because arc_ecto
swallowed up the error, it takes too much time to debug it.
Better to raise an error than to handle it that way.
Back in February, I had arc_ecto configured and working just fine to upload images to S3 and save the path to my database. As sometimes happens with projects, the client didn't start using what I had built until earlier this week, and (without any changes to deps or related files since February on my part) things don't seem to work any longer. When I try to upload an image, I get the error mentioned in the title. Here's my ImageUploader file:
Here's my Ecto Model file:
Here's the map I'm passing to the changeset method on update, along with a model struct:
Here's the error I'm getting in its entirety:
I'm pretty stumped here. It seems as if the custom type has stopped working, and I could see that happening if any of deps had crept, but I really don't think they have. Here are my pinned versions for reference:
Any help would be much appreciated.