Closed aximuseng closed 4 years ago
I had a hunch that is was Dropzone (which still may be the issue). My old app used 4.x and this new one was 5.x. I downgraded and the issue persists.
I have another uploader that works fine - the issue is just this one which happens to use Dropzone.js
I switched to FOG and I get the same error - looks like a temp file issue. I get a better error message via fog:
Excon::Error::NotFound
Expected(200) <=> Actual(404 Not Found)
excon.error.response
:body => "<Error><Code>NoSuchKey</Code><Message>The specified key does not exist.</Message><Key>uploads/tmp/1571981392-820410573725319-0002-3934/LDT_export.xlsx</Key><RequestId>968BFF30B5502600</RequestId><HostId>yoqwixTfgqxppxOTsC6yKI2NJDY8YvmsuHFqvJkaC3IfzauEvyGBSch/b2pu/gdrTb6taxQSUQc=</HostId></Error>"
:cookies => [
]
:headers => {
"Content-Type" => "application/xml"
"Date" => "Fri, 25 Oct 2019 05:29:55 GMT"
"Server" => "AmazonS3"
"x-amz-delete-marker" => "true"
"x-amz-id-2" => "yoqwixTfgqxppxOTsC6yKI2NJDY8YvmsuHFqvJkaC3IfzauEvyGBSch/b2pu/gdrTb6taxQSUQc="
"x-amz-request-id" => "968BFF30B5502600"
"x-amz-version-id" => "NPV4VoXhQ8OrY2vOSqmjYLrgEqELxjlt"
}
:host => "otproduction.s3.us-west-2.amazonaws.com"
:local_address => "159.203.1.40"
:local_port => 51808
:path => "/locations/hdnw2xf8/uploads/mc4x2klf/LDT_export.xlsx"
:port => 443
:reason_phrase => "Not Found"
:remote_ip => "52.218.217.193"
:status => 404
:status_line => "HTTP/1.1 404 Not Found\r\n"
I don't think it's related to this gem - perhaps carrierwave specific.
This issue strikes again. I thought I had this addressed. The error would just show up as an annoyance in my Sentry.io logs. Now in my recent update throws an error (sort of).
Here is my code:
if feed_params[:file]
upload = @feedable.uploads.new(notes: feed_params[:notes], uploadable_type: @feed.feedable.class.base_class.name, uploadable_id: @feed.feedable.id)
upload.file = feed_params[:file]
upload.save
@feed.update(linkable_type: 'Upload', linkable_id: upload.id)
end
I am creating a record and then if the user uploaded a file I create a new upload. The file uploads and is saved in the DB. The controller stops after the upload.save and throws the error but not a full exception. If I manually refresh the upload is there but that @feed.update after the save is never executed.
Zero clue where to look next on this.
Current Gemfile.lock:
carrierwave (2.1.0)
activemodel (>= 5.0.0)
activesupport (>= 5.0.0)
addressable (~> 2.6)
image_processing (~> 1.1)
mimemagic (>= 0.3.0)
mini_mime (>= 0.1.3)
carrierwave-aws (1.5.0)
aws-sdk-s3 (~> 1.0)
carrierwave (~> 2.0)
This one does NOT use dropzone.
I did some digging in my uploaders. The offending uploader had this:
def full_filename (for_file = model.file.file)
"preview_thumb.jpg"
end
I was setting my versions to static names. I don't need this and don't know why this fixes it or caused the problem but hopefully this helps anyone down the road that hits this error. Also not sure why fog had the same error.
Thanks for reporting your struggle and the solution here @aximuseng!
Here is my Gemfile.lock info:
When the controller saves the carrierwave upload (it does uload and persist in the DB) if it throws
multipart_copy: file.size >= MULTIPART_TRESHOLD
at withundefined method
>=' for nil:NilClass`My old app works with CW 1.0.0. and CW-aws 1.1.0 but I can't seem to downgrade to that in my current app without breaking other dependancies.
The upload is successful - just fails and hangs the app at that point (no exception thrown). A page refresh shows the file uploaded etc.