mhanberg / jekyll-postcss

A plugin to use PostCSS plugins like Autoprefixer or Tailwind CSS with Jekyll.
MIT License
66 stars 12 forks source link

Build seems to be stuck on Netlify #8

Closed thbar closed 4 years ago

thbar commented 4 years ago

Hello!

Thanks for your gem. I was trying to use the latest version (0.3.0) on netlify, but apparently the build never returns.

If I remove the gem completely (from both Gemfile and Jekyll config), the build works fine.

I wonder if this is related to the changes in v0.3.0 (tcp server) which may be forbidden there.

I will investigate further (and will try older version), but wanted to report that.

mhanberg commented 4 years ago

Thanks for the bug report!

I think the tcp server should be fine, but I’ll give it a look. I haven’t deployed my blog yet with this update, so maybe that’s why it slipped through.

thbar commented 4 years ago

Thanks for the quick reply! Reverting to previous version seems to work, if I'm not mistaken and fwiw!

mhanberg commented 4 years ago

Do you mind sharing

Thanks! @thbar

thbar commented 4 years ago

The tail of the log looks like this:

6:31:04 PM: Verify run directory
6:31:04 PM: Executing user command: bundle exec jekyll build
6:31:04 PM: Configuration file: /opt/build/repo/_config.yml
6:34:31 PM: Canceling deploy

(Canceling is triggered by me). This must be compared to this when a full build works (with previous version:

6:50:19 PM: Verify run directory
6:50:19 PM: Executing user command: bundle exec jekyll build
6:50:20 PM: Configuration file: /opt/build/repo/_config.yml
6:50:20 PM:             Source: /opt/build/repo/src
6:50:20 PM:        Destination: /opt/build/repo/_site
6:50:20 PM:  Incremental build: disabled. Enable with --incremental
6:50:20 PM:       Generating...
6:50:26 PM:                     done in 5.996 seconds.
6:50:26 PM:  Auto-regeneration: disabled. Use --watch to enable.

Ruby version: 2.6.2 (to accelerate build on Netlify, where it is apparently the default, but 2.6.6 will achieve the same result)

Node version: v12.16.1

Jekyll: 4.0.1

Build: bundle exec jekyll build

Hope this helps!

mhanberg commented 4 years ago

Thanks, I've confirmed this with my own blog.

My hypotheses are there is some path shenanigans going on, or some Node.js sandboxing of which I am unaware.

I've opened a topic on the Netlify discourse: https://community.netlify.com/t/deploy-is-hanging/14822

thbar commented 4 years ago

I would be surprised if Netlify doesn't block TCP socket opening, or at least restrict it:

https://github.com/mhanberg/jekyll-postcss/compare/v0.2.2...v0.3.0#diff-b7eb3592a63ae055d731d361a948afbfR17-R24

I would probably add a log in that silent rescue ;-)

Good luck chasing that, I'll comment back if I find something!

thbar commented 4 years ago

Link correction: https://github.com/mhanberg/jekyll-postcss/blob/5cf6d998a07f2152c2856cabc096ee09df53c490/lib/jekyll-postcss/socket.rb#L16-L23

mhanberg commented 4 years ago

If I add a log there, it will print out about 5000 lines haha.

The server is misty a dev convenience. In production it might be easier to just run it directly.

thbar commented 4 years ago

Ahh! I see, indeed. Maybe add a little delay, and a limit to the loop? An explanation could be that the code never leaves that loop!

thbar commented 4 years ago

In all cases, thanks for your gems & also starter kits, because I migrated my little website (at https://www.kiba-etl.org) from raw pages with tailwind to Jekyll, and it was helpful!

mhanberg commented 4 years ago

The fixed has been released with v0.3.1!

thbar commented 4 years ago

@mhanberg thanks for the quick turn-around. I've tested and indeed it works for me. Many thanks!

steveoh commented 4 years ago

I think this needs to be more stressed. I figured the reason you mentioned it is that you're using the env variable in the postcss config on your demo repo only. I didn't realize it would hang in netlify and y local docker env.

mhanberg commented 4 years ago

@steveoh I will update the README to further highlight the requirement to set the JEKYLL_ENV on your build server, but I will note that it currently states that your build might fail if you don't set it.

steveoh commented 4 years ago

failing and hanging are a little different. I thought it might be taking a while to process since we have 500 pages. but you are right, you did mention that.