s3_website
s3_website copied to clipboard
Errors parsing ERB on s3_website push
I'm getting errors when I try to do an s3_website push
.
Using the circleci/ruby:2.5
Docker image:
[fail] Could not load the site: Failed to parse ERB in /home/circleci/repo/s3_website.yml:
(SyntaxError) /usr/local/lib/ruby/site_ruby/2.5.0/rubygems/core_ext/kernel_warn.rb:15: syntax error, unexpected tLABEL
module_function define_method(:warn) {|*messages, uplevel: nil|
Using the circleci/ruby:2.6
Docker image:
[fail] Could not load the site: Failed to parse ERB in /home/circleci/t/s3_website.yml:
(SyntaxError) /usr/local/lib/ruby/2.6.0/uri/common.rb:454: syntax error, unexpected tLABEL
def self.decode_www_form(str, enc=Encoding::UTF_8, separator: '&', use__charset_: false, isindex: false)
This is the same error as in #306. Unlike #306, though, I've been unable to fix it by upgrading Ruby or by rebuilding my environment. To reproduce the error, launch a Docker container (docker run -i -t circleci/ruby:2.5
), then run the following commands within the container:
cd ~
bundle init
echo "gem 's3_website'" >> Gemfile
bundle
sudo apt install default_jre
touch s3_website.yml
bundle exec s3_website.yml push
If I understand correctly, s3_website is using JRuby 1.7. The error messages make it sound like s3_website's JRuby is inheriting environment settings from the Ruby 2.5 or 2.6 Bundler that cause it to try and load Ruby gems that only work in Ruby 2.0 and above, so it runs into errors as a result. (However, I'm inexperienced at Ruby and have never used JRuby, so I could be completely mistaken here.)
As a workaround, if I manually invoke the JAR file, it works:
bundle exec s3_website install
java -cp $(bundle show s3_website)/*.jar s3.website.Push
If I pass the same RUBYLIB
environment variable that bundle
uses internally, it fails: (This seems to support my theory that s3_website's JRuby is having problems because it's inheriting Ruby 2.5 or 2.6 settings from Bundler.)
RUBYLIB=/usr/local/lib/ruby/2.5.0 java -cp $(bundle show s3_website)/*.jar s3.website.Push
Hey there, I'm also having this issue on Codeship since yesterday (17th Jan).
Few other people experiencing the issue here: https://stackoverflow.com/questions/54175990/how-to-fix-s3-website-issue-while-pushing-jekyll-site-on-cloudfront-through-gi
I'll try your Java workaround...
Edit: Success! 🎉 Thanks mate.
So as a workaround, could we just set the correct RUBYLIB at the start of our deploy scripts? What would that be? Ruby 1.7?
So as a workaround, could we just set the correct RUBYLIB at the start of our deploy scripts? What would that be? Ruby 1.7?
If I understand correctly, the problem is that one of the Ruby components is setting RUBYLIB itself, maybe as part of setting up the Bundler environment to invoke s3_website. In other words, I don't think that changing RUBYLIB before calling bundle exec
would help, because it's getting set somewhere within bundle exec
.
There may be a way to tell Ruby + Bundler to not set and pass RUBYLIB; I don't know.
@joshkel It worked. Thank you so much.
How would you do this while passing --config-dir ?
Hey all, just so you know I've had another issue related to this that nearly killed me.
This was the error:
Error: Could not find or load main class s3.website.Push
Caused by: java.lang.ClassNotFoundException: s3.website.Push
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] deploy: `./scripts/deploy.sh`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] deploy script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
I think I fixed it by doing rvm install 1.7
inside my CI. Then I did rvm use 1.7
tried to run the build, it failed because bundler
needed a minimum of Ruby 2. Then I put everything back and it works again. To be honest I don't know what caused it, or if this is exactly how I fixed it. And now it's fixed, I'm too scared to try and replicate the error.
I would STRONGLY suggest NOT using this plugin in production. The longer this goes unmaintained, the more risk other gems are going to break it. I am really regretting choosing this for our stack.
Have a nice Friday everybody
The workaround provided above was working fine until today, I reverted back to using s3_website
with the original way of calling and it started working again. Here's my diff and .travis.yml file.
@nabilfreeman if you encourage others to not use this library, do you have another recommendation?
If your AWS credentials are in .env
, this modification to the workaround is needed:
env $(cat .env | xargs) java -cp $(bundle show s3_website)/*.jar s3.website.Push
Facing the same issue with ruby 2.3 & 2.5 when running from a fresh environment in Drone CI.
Hi all, my build broke again today so I carefully looked through this issue to see if I did a step by accident last time round that got it working.
I think it's necessary to run bundle exec s3_website install
before the java thing will work.
The comments on @knowuh's commit explained it really well: https://github.com/concord-consortium/lab-interactives-site/commit/cab8e929bbc5e28f77d1dba0fca84fb58f4b8169
So I think a few months back I frantically copy pasted until things worked. As for why it only broke today, I'm not sure. Maybe Codeship keeps the same VM for a really long time? Or I got lucky again.
p.s. @jvtrigueros, sorry that my last comment wasn't very helpful. I think the thing that frustrates me is that there are no other options that I know of that give this level of flexibility when deploying Jekyll (redirects, etc.). Plus I don't know Scala, so I can't fork the project easily without a full re-write in Ruby (best) or JS (cos it's the only other thing I know).
I also faced the same issue.
when I solved my java issue with this workaround
on s3_website push
I got :
[fail] Could not load the site: Failed to parse ERB in /Users/ankushmalik/Desktop/jekyll/aw/s3_website.yml:
(SyntaxError) /Users/ankushmalik/.rvm/rubies/ruby-2.6.0/lib/ruby/2.6.0/uri/common.rb:454: syntax error, unexpected tLABEL
def self.decode_www_form(str, enc=Encoding::UTF_8, separator: '&', use__charset_: false, isindex: false)
I just downgraded my rvm ruby version to 2.4 and then I was able to execute s3_website push successfully. 😸 🎉 I hope this helps someone