Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NoMethodError (undefined method `copy_object' for "close":String) #702

Open
softmonkeyjapan opened this issue Mar 8, 2024 · 5 comments
Open

Comments

@softmonkeyjapan
Copy link

softmonkeyjapan commented Mar 8, 2024

Since today on my production server, I'm experiencing a weird error that seems to come from fog-was's copy_object method call. I've checked other library invovled and none of them have a method name copy_object.

Stack

  • ruby 2.7.0
  • rails 6.1.3
  • carrierwave 3.0.4
  • fog-core 2.3.0
  • fog-aws 3.21.0

When doing a regular file assignment:

object.image = File.open(...)
object.save!

I'm getting the following error:

NoMethodError (undefined method `copy_object' for "close":String)

If I try to do the same with remote_attribute_url I still get the error. Not sure if this is a carrierwave issue or not. Anyone can help ?

EDIT

Not sure if this is related but whenever I'm affecting a file to my model uploader, i'm getting the following warning:

[fog][DEPRECATION] #connection= is deprecated, pass :service in at creation (/Users/loic/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/fog-core-2.3.0/lib/fog/core/attributes.rb:134:in `block in merge_attributes')
@geemus
Copy link
Member

geemus commented Mar 8, 2024

Hey, sorry to hear you are having issues. I haven't heard of this before, so I'm left to speculate a bit.

This sounds like a type-safety kind of issue. copy_object is certainly defined on fog's File objects, so my initial guess is that somewhere that expects a file object is being given a string (or perhaps a non-fog File) and then the fog and/or carrierwave machinery is trying to do it's thing and is not succeeding.

I don't know enough about your particular setup to pin this down just yet. Could you share a bit more of what the code in object looks like?

Also, I don't think that deprecation should lead to this particular problem, though it would be good to fix that issue as well (as eventually I'd like to remove the deprecated things altogether to clean things up).

@iprog21
Copy link

iprog21 commented May 21, 2024

Is this resolved? I'm facing the same issue.

@geemus
Copy link
Member

geemus commented May 21, 2024

@iprog21 I hadn't heard any additional details, so I didn't have anything else to go on. I'm happy to look again and try to work through it with you if you can provide some more details of how you are using things and maybe some stack traces.

@iprog21
Copy link

iprog21 commented May 21, 2024

@iprog21 I hadn't heard any additional details, so I didn't have anything else to go on. I'm happy to look again and try to work through it with you if you can provide some more details of how you are using things and maybe some stack traces.

HI @geemus . I saw the root in my code, seems its on the conversion of the image when uploading. its on the ImageMagick. My temporary fix is disable the versioning since this is only my personal project so I am aware to upload small size image only.

So if you can check it too, try adding versions, if that will appear on your end.

@geemus
Copy link
Member

geemus commented May 21, 2024

Glad to hear you have a workaround for now. Unfortunately on my side I haven't used these libraries myself in quite some time, so I don't have an existing setup that I can easily change to test against.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants