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

undefined method `=~' for 3:Integer #535

Open
badde-media opened this issue Apr 9, 2024 · 4 comments
Open

undefined method `=~' for 3:Integer #535

badde-media opened this issue Apr 9, 2024 · 4 comments

Comments

@badde-media
Copy link

badde-media commented Apr 9, 2024

I have a rather fresh install of activestorage-openstack, which seems to build upon fog-openstack.

I've tried to upload a test jpg file to my Infomaniak s3 comp object storage, but I get this error:

Loading development environment (Rails 7.1.3.2)
irb(main):001* blob = ActiveStorage::Blob.create_and_upload!(
irb(main):002*   io: File.open("./public/sleep.jpg", 'rb'),
irb(main):003*   filename: "sleep.jpg",
irb(main):004*   content_type: "image/jpg"
irb(main):005> )
  TRANSACTION (0.0ms)  begin transaction
  ActiveStorage::Blob Create (0.3ms)  INSERT INTO "active_storage_blobs" ("key", "filename", "content_type", "metadata", "service_name", "byte_size", "checksum", "created_at") VALUES (?, ?, ?, ?, ?, ?, ?, ?) RETURNING "id"  [["key", "irdd44jxhg8zzh9ado2ogy61kzdj"], ["filename", "sleep.jpg"], ["content_type", "image/jpeg"], ["metadata", "{\"identified\":true}"], ["service_name", "infomaniak"], ["byte_size", 526621], ["checksum", "H3N/tmO1/TcKfCdnEyIOOQ=="], ["created_at", "2024-04-09 19:22:37.714505"]]
  TRANSACTION (6.6ms)  commit transaction
  OpenStack Storage (9.7ms) Uploaded file to key: irdd44jxhg8zzh9ado2ogy61kzdj (checksum: H3N/tmO1/TcKfCdnEyIOOQ==)
/home/un/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/bundler/gems/fog-openstack-794aa8b36a06/lib/fog/openstack/auth/token.rb:17:in `build': undefined method `=~' for 3:Integer (NoMethodError)

It works when I use config.active_storage.service = :local but that's not the intention.

Copilot keeps telling me that I should fork your gem, rewrite it and try again.

I have already tried @chaadow's version but that has the same error

Please let me know if I can help

@geemus
Copy link
Member

geemus commented Apr 9, 2024

It looks like it's receiving an integer for the api version, while expecting a string (and then erroring because it's trying to compare a regex to an integer instead of a string) here: https://github.com/fog/fog-openstack/blob/master/lib/fog/openstack/auth/token.rb#L17

It looks like it's expecting something like "v3", but receiving something like 3. Are you setting this value in the config for fog-openstack? It looked like it might be a config value, rather than something coming back from a call, but I haven't used this codebase in a very long time.

@badde-media
Copy link
Author

No, I'm setting this value in the Rails credentials. But yes, what you say is exactly what Copilot said. Should be an easy fix. I'll try v3, too, but I don't think that it will work

@badde-media
Copy link
Author

As expected, same error when using "v3".

badde-media added a commit to badde-media/fog-openstack that referenced this issue Apr 10, 2024
Trying to fix this error (fog#535) by changing the input to_s before trying to match it with the regex
@badde-media
Copy link
Author

Using my patched version, the bug is gone but I still get an authentication error. At least one step ahead ^^'

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

2 participants