Skip to content

Bucket name gets confused with config.assets.prefix #399

@SaimonL

Description

@SaimonL

I don't know where to post this bug.

The problem is if you set the config.assets.prefix to the folder you want to put your static compiled assets in to, rails or asset_sync or fog-aws gets confused and use that as a bucket name.

For an example:

config.asset_sync.fog_directory = ENV['FOG_DIRECTORY']
config.assets.prefix = '/production/assets'

This will result in error message:

<?xml version="1.0" encoding="UTF-8"?>\n<Error>
<Code>NoSuchBucket</Code>
<Message>The specified bucket does not exist</Message>
<Key>assets/application-e3315f5ba5eabff081ffb04b6739f7847a31fb8131b128c8a9193ff59226b010.css</Key>
<BucketName>production</BucketName>
<Resource>/production/assets/application-e3315f5ba5eabff081ffb04b6739f7847a31fb8131b128c8a9193ff59226b010.css</Resource>
<RequestId>15F7DDD2C34819B8</RequestId>
<HostId>7d382a88-687c-4695-b0c8-....</HostId>
</Error><?xml version="1.0" encoding="UTF-8"?>

Now if you set the config.assets.prefix to the bucket name then everything works fine.

config.asset_sync.fog_directory = ENV['FOG_DIRECTORY']
config.assets.prefix = ENV['FOG_DIRECTORY']

If you set config.assets.prefix to empty string then it will fail with bucket name being "assets".

More Info

OS: Ubuntu 18.04 LTS
Asset Server: MinIO/RELEASE.2020-02-27T00-23-05Z
Rails 5.2.4.1
Ruby 2.6.5

Bundle List
Gems included by the bundle:

  • actioncable (5.2.4.1)
  • actionmailer (5.2.4.1)
  • actionpack (5.2.4.1)
  • actionview (5.2.4.1)
  • activejob (5.2.4.1)
  • activemodel (5.2.4.1)
  • activerecord (5.2.4.1)
  • activestorage (5.2.4.1)
  • activesupport (5.2.4.1)
  • arel (9.0.0)
  • asset_sync (2.10.0)
  • autoprefixer-rails (9.7.4)
  • awesome_print (1.8.0)
  • bcrypt (3.1.13)
  • better_errors (2.6.0)
  • bindex (0.8.1)
  • binding_of_caller (0.8.0)
  • bootsnap (1.4.6)
  • bootstrap (4.4.1)
  • builder (3.2.4)
  • byebug (11.1.1)
  • coderay (1.1.2)
  • coffee-rails (4.2.2)
  • coffee-script (2.4.1)
  • coffee-script-source (1.12.2)
  • concurrent-ruby (1.1.6)
  • crass (1.0.6)
  • crono (1.1.2)
  • daemons (1.3.1)
  • database_cleaner (1.8.3)
  • database_cleaner-active_record (1.8.0)
  • debug_inspector (0.0.3)
  • delayed_job (4.1.8)
  • delayed_job_active_record (4.1.4)
  • delayed_job_web (1.4.3)
  • diff-lcs (1.3)
  • dropzonejs-rails (0.8.4)
  • erubi (1.9.0)
  • erubis (2.7.0)
  • eventmachine (1.2.7)
  • excon (0.72.0)
  • execjs (2.7.0)
  • factory_bot (5.1.1)
  • factory_bot_rails (5.1.1)
  • faker (2.10.2)
  • ffi (1.12.2)
  • fog-aws (3.5.2)
  • fog-core (2.2.0)
  • fog-json (1.2.0)
  • fog-xml (0.1.3)
  • font-awesome-sass (5.12.0)
  • formatador (0.2.5)
  • globalid (0.4.2)
  • guard (2.16.1)
  • guard-compat (1.2.1)
  • guard-rspec (4.7.3)
  • haml (5.1.2)
  • haml-rails (2.0.1)
  • html2haml (2.2.0)
  • i18n (1.8.2)
  • ipaddress (0.8.3)
  • jquery-rails (4.3.5)
  • listen (3.1.5)
  • loofah (2.4.0)
  • lumberjack (1.2.4)
  • mail (2.7.1)
  • marcel (0.3.3)
  • meta_request (0.7.2)
  • method_source (0.9.2)
  • mime-types (3.3.1)
  • mime-types-data (3.2019.1009)
  • mimemagic (0.3.4)
  • mini_mime (1.0.2)
  • mini_portile2 (2.4.0)
  • minitest (5.14.0)
  • msgpack (1.3.3)
  • multi_json (1.14.1)
  • mustermann (1.1.1)
  • nenv (0.3.0)
  • nio4r (2.5.2)
  • nokogiri (1.10.8)
  • notiffany (0.1.3)
  • pg (1.2.2)
  • popper_js (1.16.0)
  • pry (0.12.2)
  • pry-byebug (3.8.0)
  • pry-rails (0.3.9)
  • puma (3.12.3)
  • rack (2.2.2)
  • rack-contrib (2.1.0)
  • rack-protection (2.0.8.1)
  • rack-test (1.1.0)
  • rails (5.2.4.1)
  • rails-dom-testing (2.0.3)
  • rails-html-sanitizer (1.3.0)
  • railties (5.2.4.1)
  • rake (13.0.1)
  • rb-fsevent (0.10.3)
  • rb-inotify (0.10.1)
  • rspec (3.9.0)
  • rspec-core (3.9.1)
  • rspec-expectations (3.9.0)
  • rspec-mocks (3.9.1)
  • rspec-rails (3.9.0)
  • rspec-support (3.9.2)
  • ruby2_keywords (0.0.2)
  • ruby_dep (1.5.0)
  • ruby_parser (3.14.2)
  • sass (3.7.4)
  • sass-listen (4.0.0)
  • sass-rails (5.1.0)
  • sassc (2.2.1)
  • sassc-rails (2.1.2)
  • sexp_processor (4.14.1)
  • shellany (0.0.1)
  • shoulda-matchers (4.3.0)
  • sinatra (2.0.8.1)
  • spring (2.1.0)
  • spring-watcher-listen (2.0.1)
  • sprockets (3.7.2)
  • sprockets-rails (3.2.1)
  • temple (0.8.2)
  • thin (1.7.2)
  • thor (1.0.1)
  • thread_safe (0.3.6)
  • tilt (2.0.10)
  • turbolinks (5.2.1)
  • turbolinks-source (5.2.0)
  • tzinfo (1.2.6)
  • tzinfo-data (1.2019.3)
  • uglifier (4.2.0)
  • unf (0.1.4)
  • unf_ext (0.0.7.6)
  • web-console (3.7.0)
  • websocket-driver (0.7.1)
  • websocket-extensions (0.1.4)
  • whois (5.0.1)
  • will_paginate (3.3.0)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions