question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

New Docker-based Parcel Build does not work on CircleCI (and likely other CI platforms)

See original GitHub issue

In 1.38.0, the build was moved into a docker container by this PR: https://github.com/aws/aws-cdk/pull/7169

This is causing builds to fail on our CircleCI platform used for continuous delivery of CDK changes.

The issue

You can see the error in the CircleCI interface here: https://app.circleci.com/pipelines/github/blimmer/cdk-parcel-docker-circleci-issue/4/workflows/a4808b45-a04c-48af-851f-960f888518fd/jobs/7

We can easily start up docker-in-docker by using Circle’s setup_remote_docker command.

However, when the parcel image tries to run lscpu, the failure causes the build to break.

#!/bin/bash -eo pipefail
npx cdk synth

Failed to build file at /home/circleci/project/lib/index.ts: Error: [Status 1] stdout: 🚨  No entries found.

    at Bundler.bundle (/usr/local/share/.config/yarn/global/node_modules/parcel-bundler/src/Bundler.js:275:17)

stderr: /bin/sh: lscpu: not found

Subprocess exited with error 1
Exited with code exit status 1
CircleCI received exit code 1

There are a number of issues on the parcel issue tracker about this issue on CI platforms: https://github.com/parcel-bundler/parcel/issues?q=is%3Aissue+sort%3Aupdated-desc+lscpu+is%3Aclosed

Reproduction Steps

I’ve created this example repo to show the problem: https://github.com/blimmer/cdk-parcel-docker-circleci-issue

Error Log

Failed to build file at /home/circleci/project/lib/index.ts: Error: [Status 1] stdout: 🚨  No entries found.

    at Bundler.bundle (/usr/local/share/.config/yarn/global/node_modules/parcel-bundler/src/Bundler.js:275:17)

stderr: /bin/sh: lscpu: not found

Environment

  • CLI Version : 1.38.0
  • Framework Version: 1.38.0
  • OS : MacOS / Ubuntu (on CircleCI)
  • Language : English

Other

A fix

I can confirm that passing the PARCEL_WORKERS environment variable to the docker run parcel-bundler image resolves the problem. I got the idea to try that from this comment on the parcel side: https://github.com/parcel-bundler/parcel/issues/133#issuecomment-619991475

I used CircleCI’s SSH feature to interactively test this.

circleci@0d67793e2a50:~/project$ docker run parcel-bundler
Server running at http://localhost:1234
/bin/sh: lscpu: not found
🚨  No entries found.
    at Bundler.bundle (/usr/local/share/.config/yarn/global/node_modules/parcel-bundler/src/Bundler.js:275:17)
    at async Bundler.serve (/usr/local/share/.config/yarn/global/node_modules/parcel-bundler/src/Bundler.js:842:7)
    at async Command.bundle (/usr/local/share/.config/yarn/global/node_modules/parcel-bundler/src/cli.js:241:20)

no errors when passing the PARCEL_WORKERS param.

circleci@0d67793e2a50:~/project$ docker run parcel-bundler -e PARCEL_WORKERS=2

Suggestion

Most all CI platforms set the CI environment variable to true. Maybe if CI is set, CDK automatically passes the PARCEL_WORKERS parameter in the docker run args?

https://github.com/aws/aws-cdk/pull/7169/files#diff-30cb98bb231179d8900591911d5cc8a4R75-R80

Alternatively, you could try to fix this problem in the docker image itself if lscpu is not present.


This is 🐛 Bug Report

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:17 (16 by maintainers)

github_iconTop GitHub Comments

3reactions
blimmercommented, Jun 30, 2020

For others that might be running into this problem in CircleCI, I highly recommend switching from the Docker executor to the Machine executor. Even with the improvements referenced in this ticket, there are still issues with how CircleCI runs docker-in-docker that causes tons of headaches with lambda bundling.

Simply change your job definition from something like this:

docker:
  - image: circleci/node:lts

to using a machine executor like this:

machine:
  image: ubuntu-1604:202004-01
1reaction
TLaddcommented, Dec 23, 2020

Ended up here because I was having trouble getting our cdk deploy running in CircleCI. Can confirm that switching to the machine executor still works.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Troubleshooting Server Installations - CircleCI
This document describes an initial set of troubleshooting steps to take if you are having problems with your CircleCI installation on your private...
Read more >
Note: Unit number 2,3,4,5 is available
a packet from one network to another network to the microservices. ... a problem is coming to create a new feature or module...
Read more >
NodeJS jobs from Hacker News 'Who is hiring? (July 2021)' post
We're looking for strong engineers with many of the following: * 3+ years of full-time software engineering experience * Experience building ...
Read more >
Top Amazon Elastic Container Registry (ECR) Alternatives in 2022
Container Registry, which is built using object storage, provides high ... Push private images to run them in the IBM Cloud®, Kubernetes Service...
Read more >
Remote Developer + Engineer + Engineering + Full Stack Jobs with ...
Browse 20+ Remote Developer Engineer Engineering Full Stack Jobs in November 2022 at companies like Simple Poll, Sana Benefits and Flyp with salaries...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found