Hi Team, I am trying to build docker image using t...
# troubleshoot

Question

How can I resolve errors while building a Docker image with version 0.8.40 and yarnBuild fails with a non-zero exit code 131? Also, what might cause an 'invalid argument' error while building an image in a Dockerfile? How can I debug or resolve the issue?

Answer

There could be multiple reasons for yarnBuild to fail. Some suggestions to resolve this include removing any recent changes to the build process and ensuring that node versions match those set in the build.gradle file. Additionally, running './gradlew clean' might help clean any previously failed builds. In case of an 'invalid argument' error, ensure that the specified platform matches the required format. To debug the issue, try checking logs for more information and verifying that required policies and permissions are applied to the user along with setting up the JAVA_HOME environment variable correctly.

h
Hi Team, I am trying to build docker image using the 0.8.40 version . Facing this error, Any suggestions for this -
Copy code
FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':datahub-web-react:yarnBuild'.
> Process 'command 'yarn'' finished with non-zero exit value 131

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at <https://help.gradle.org>

BUILD FAILED in 2m 26s
b
Hi Keerthi! could you post the full stack trace that should come above this? I'm curious what's making
yarnBuild
fail here. Have you changed any code in datahub-web-react?
e
Hi @handsome-football-66174 can you share which command you’re running?
b
^ also that
h
@echoing-airport-49548 @bulky-soccer-26729 I am using the following commands - DOCKER_BUILDKIT=1 docker build -t testdockerimage -f ./docker/datahub-frontend/Dockerfile . docker build -t testdockerimage -f ./docker/datahub-frontend/Dockerfile . The only changes I made was for the distBaseUrl(pointing to our artifactory) in build.gradle and the repositories.gradle (pointing to our artifactory)
@bulky-soccer-26729 @echoing-airport-49548 - Let me know if you have some time to connect on this or any suggestions .
b
so you changed
distBaseUrl
in build.gradle in datahub-web-react? I wonder if that's throwing off your node version compared to what we have set in build.gradle?
h
@bulky-soccer-26729 - the distbaseUrl was modified to point to our artifactory . What version of node is required ?
b
I believe as long as the node versions match up then it shouldn't be a problem (I could be wrong here) - but if you check build.gradle, the version should be set there for you (mine is
16.8.0
)
h
@bulky-soccer-26729 - Does this make a difference , this is in /docker/datahub-frontend/Dockerfile
Copy code
FROM --platform=$BUILDPLATFORM node:16.13.0-alpine3.14 AS prod-build
b
no that will be for datahub-frontend, I think your issue here is datahub-web-react (also I have the same line in my /docker/datahub-frontend/Dockerfile as well)
h
@bulky-soccer-26729 Any pointers on how to debug/resolve the issue ?
@bulky-soccer-26729 @echoing-airport-49548 - Latest error
Copy code
$ graphql-codegen --config codegen.yml
[17:33:23] Parse configuration [started]
node:events:368
   throw er; // Unhandled 'error' event
   ^

Error: write EPIPE
  at afterWriteDispatched (node:internal/stream_base_commons:164:15)
  at writeGeneric (node:internal/stream_base_commons:155:3)
  at Socket._writeGeneric (node:net:795:11)
  at Socket._write (node:net:807:8)
  at writeOrBuffer (node:internal/streams/writable:389:12)
  at _write (node:internal/streams/writable:330:10)
  at Socket.Writable.write (node:internal/streams/writable:334:10)
  at console.value (node:internal/console/constructor:285:16)
  at console.log (node:internal/console/constructor:359:26)
  at exports.log (/datahub-src/datahub-web-react/node_modules/listr-verbose-renderer/lib/utils.js:13:10)
Emitted 'error' event on Socket instance at:
  at emitErrorNT (node:internal/streams/destroy:157:8)
  at emitErrorCloseNT (node:internal/streams/destroy:122:3)
  at processTicksAndRejections (node:internal/process/task_queues:83:21) {
 errno: -32,
 code: 'EPIPE',
 syscall: 'write'
}

> Task :datahub-web-react:yarnBuild FAILED

> Task :li-utils:generateDataTemplate
There are 33 data schema input files. Using input root folder: /datahub-src/li-utils/src/main/pegasus
[main] INFO com.linkedin.pegasus.generator.DataTemplateGeneratorCmdLineApp - Generating 34 files

Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See <https://docs.gradle.org/6.9.2/userguide/command_line_interface.html#sec:command_line_warnings>
29 actionable tasks: 29 executed

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':datahub-web-react:yarnBuild'.
> Process 'command 'yarn'' finished with non-zero exit value 131

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at <https://help.gradle.org>

BUILD FAILED in 54s
b
if you remove the two small changes that you made to you build process and restart from scratch, do your errors get resolved? it'd be nice to narrow this down to a general issue or an issue with your specific changes
h
@bulky-soccer-26729 - get this error without any change to v0.8.40
Copy code
Step 5/26 : FROM --platform=$BUILDPLATFORM node:16.13.0-alpine3.14 AS prod-build
failed to parse platform : "" is an invalid component of "": platform specifier component must match "^[A-Za-z0-9_-]+$": invalid argument
e
Hi @handsome-football-66174 could you try running ./gradlew clean first and then rerun these commands?
h
@echoing-airport-49548 Getting this error-
Copy code
> Task :buildSrc:compileJava FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':buildSrc:compileJava'.
> Could not find tools.jar. Please check that /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.312.b07-1.amzn2.0.2.x86_64/jre contains a valid JDK installation.
Set up JAVA_HOME and pointing to the artifactory repos we use correctly and was able to run ./gradlew clean
It is throwing this error while building -
Copy code
$ graphql-codegen --config codegen.yml
node:events:368
      throw er; // Unhandled 'error' event
      ^

Error: write EPIPE
    at afterWriteDispatched (node:internal/stream_base_commons:164:15)
    at writeGeneric (node:internal/stream_base_commons:155:3)
    at Socket._writeGeneric (node:net:795:11)
    at Socket._write (node:net:807:8)
    at writeOrBuffer (node:internal/streams/writable:389:12)
    at _write (node:internal/streams/writable:330:10)
    at Socket.Writable.write (node:internal/streams/writable:334:10)
    at console.value (node:internal/console/constructor:285:16)
    at console.log (node:internal/console/constructor:359:26)
    at exports.log (/datahub-src/datahub-web-react/node_modules/listr-verbose-renderer/lib/utils.js:13:10)
Emitted 'error' event on Socket instance at:
    at emitErrorNT (node:internal/streams/destroy:157:8)
    at emitErrorCloseNT (node:internal/streams/destroy:122:3)
    at processTicksAndRejections (node:internal/process/task_queues:83:21) {
  errno: -32,
  code: 'EPIPE',
  syscall: 'write'
}
b
do you have node installed on your machine? try running
node --version
h
@bulky-soccer-26729 node --version v16.8.0
@bulky-soccer-26729 @echoing-airport-49548 - Tried this on another machine ( not EC2 instance and the image built without issues )
e
Oh wow
So the initial failure was on EC2?
Would you mind sharing what type of machine it successfully built on?
h
Yes I was executing it on EC2 instance. Finally it ran on Mac.
@echoing-airport-49548 @bulky-soccer-26729 Does the Manage Access Token need to be enabled ?
e
Yes there is a separate permission for that
let me find it for you
check out our policies guide, we have a few permissions related to access tokens
you would need the
Generate Personal Access Tokens
permission in this case
h
Sure will go through the policy guide. Thank you !
@echoing-airport-49548 - Applied the policy but still getting the same issue
e
Hmm have you verified that the policy is applied to your user?
After that, can you try adding the
Manage All Access Tokens
permission and see if that resolves it?
You shouldn’t need that permission but just want to make sure
h
@echoing-airport-49548 - The issue was resolved once I set the following configuration to true in Helm charts (along with the policy ofcourse)
295 Views