AssetSync/asset_sync

Webpacker config failing

compostbrain opened this issue · 5 comments

I am deploying a rails 5.0 app with webpacker on elasticbeanstalk. We use asset_sync so I followed the instructions in the readme forwebpacker setup. I added this to the config/initializers/asset_sync file that was generated automatically and then created the asset_sync.rake file as described. Now I get an error when I try to deploy:
rake aborted! AssetSync::Config::Invalid: Existing remote files is not included in the list /var/app/ondeck/lib/tasks/asset_sync.rake:3:in block in <top (required)>'
/opt/rubies/ruby-2.5.3/bin/bundle:23:in load' /opt/rubies/ruby-2.5.3/bin/bundle:23:in

'
Tasks: TOP => assets:sync
(See full trace by running task with --trace) (Executor::NonZeroExitStatus)`

Can anyone point me to how to fix this?

Please post your entire initializer file for asset_sync
From reading the error message it seems the existing_remote_files is set to an invalid value

Valid values are enforced in code
README has mentioned valid values too

if defined?(AssetSync)
  AssetSync.configure do |config|
    config.fog_provider = 'AWS'
    config.aws_access_key_id = ENV['AWS_ACCESS_KEY_ID']
    config.aws_secret_access_key = ENV['AWS_SECRET_KEY']
    # To use AWS reduced redundancy storage.
    # config.aws_reduced_redundancy = true
    #
    # Change AWS signature version. Default is 4
    # config.aws_signature_version = 4
    #
    # Change host option in fog (only if you need to)
    # config.fog_host = "s3.amazonaws.com"
    #
    # Use http instead of https. Default should be "https" (at least for fog-aws)
    # config.fog_scheme = "http"
    config.fog_directory = "phorcys-static.ewg.org"

    # Invalidate a file on a cdn after uploading files
    # config.cdn_distribution_id = "12345"
    # config.invalidate = ['file1.js']

    # Increase upload performance by configuring your region
    config.fog_region = 'us-east-1'
    #
    # Set `public` option when uploading file depending on value,
    # Setting to "default" makes asset sync skip setting the option
    # Possible values: true, false, "default" (default: true)
    # config.fog_public = true
    #
    # Don't delete files from the store
    config.existing_remote_files = "false"
    #
    # Automatically replace files with their equivalent gzip compressed version
    # config.gzip_compression = true
    #
    # Use the Rails generated 'manifest.yml' file to produce the list of files to
    # upload instead of searching the assets directory.
    # config.manifest = true
    #
    # Upload the manifest file also.
    # config.include_manifest = false
    #
    # Fail silently.  Useful for environments such as Heroku
    # config.fail_silently = true
    #
    # Log silently. Default is `true`. But you can set it to false if more logging message are preferred.
    # Logging messages are sent to `STDOUT` when `log_silently` is falsy
    # config.log_silently = true
    #
    # Allow custom assets to be cacheable. Note: The base filename will be matched
    # If you have an asset with name `app.0ba4d3.js`, only `app.0ba4d3` will need to be matched
    # config.cache_asset_regexps = [ /\.[a-f0-9]{8}$/i, /\.[a-f0-9]{20}$/i ]
    # config.cache_asset_regexp = /\.[a-f0-9]{8}$/i
      # Disable automatic run on precompile in order to attach to webpacker rake task
    config.run_on_precompile = false
    # The block should return an array of file paths
    config.add_local_file_paths do
    # Support webpacker assets
      public_root = Rails.root.join("public")
      Dir.chdir(public_root) do
        packs_dir = Webpacker.config.public_output_path.relative_path_from(public_root)
        Dir[File.join(packs_dir, '/**/**')]
      end
    end
  end
end

I see it is set to an invalid value as you indicated. After setting it to a valid value, deploy is now successful. Thank you for your help!

@PikachuEXE Can we close this?