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.

Nomnoml service seems broken

See original GitHub issue

Current behaviour

When I curl the nomnoml engine I get this error:

$ curl -X POST -H 'Content-type: text/plain' -H 'Accept: svg+xml' --data-binary @tests/smoke/diagrams/pirate.nomnoml http://localhost:80
00/nomnoml/svg
Error 500: pkg/prelude/bootstrap.js:1185
      throw error;
      ^

Error: Cannot find module 'nomnoml'
1) If you want to compile the package/file into executable, please pay attention to compilation warnings and specify a literal in 'require' call. 2) If you don't want to compile the package/f
ile into executable and want to 'require' it from filesystem (likely plugin), specify an absolute path in 'require' call using process.cwd() or process.execPath.
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:580:15)
    at Function.Module._resolveFilename (pkg/prelude/bootstrap.js:1287:46)
    at Function.Module._load (internal/modules/cjs/loader.js:506:25)
    at Module.require (internal/modules/cjs/loader.js:635:17)
    at Module.require (pkg/prelude/bootstrap.js:1166:31)
    at require (internal/modules/cjs/helpers.js:22:18)
    at Object.<anonymous> (/snapshot/app/index.js:0:0)
    at Module._compile (pkg/prelude/bootstrap.js:1261:22)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:710:10)
    at Module.load (internal/modules/cjs/loader.js:598:32)
 (exit code 1)%

And I just noticed these warnings when I run make package for the nomnoml builder container:

$ make package
docker build -f ops/docker/alpine/Dockerfile -t kroki-builder-nomnoml:alpine -t kroki-builder-nomnoml:latest -t kroki-builder-nomnoml:0.6.1-alpine .
Sending build context to Docker daemon  71.68kB
Step 1/9 : FROM node:10.15.0-alpine
 ---> 288d2f688643
Step 2/9 : RUN npm install -g pkg pkg-fetch
 ---> Using cache
 ---> 90cdd61e6d5a
Step 3/9 : ENV NODE node10
 ---> Using cache
 ---> a624dbdc66ca
Step 4/9 : ENV PLATFORM alpine
 ---> Using cache
 ---> 7c1905875633
Step 5/9 : ENV ARCH x64
 ---> Using cache
 ---> e9a231d32196
Step 6/9 : RUN /usr/local/bin/pkg-fetch ${NODE} ${PLATFORM} ${ARCH}
 ---> Using cache
 ---> 791929534cc9
Step 7/9 : COPY . /app
 ---> c011cda81bf6
Step 8/9 : WORKDIR /app
 ---> Running in 0b9d775c3015
Removing intermediate container 0b9d775c3015
 ---> fb232be716f8
Step 9/9 : RUN /usr/local/bin/pkg --targets ${NODE}-${PLATFORM}-${ARCH} . -o app.bin
 ---> Running in 7b1757ee33e6
> pkg@4.4.0
> Warning Cannot find module 'nomnoml' from '/app'
  /app/index.js
> Warning Cannot find module 'nomnoml' from '/app'
  /app/index.js
Removing intermediate container 7b1757ee33e6
 ---> 383287f6031f
Successfully built 383287f6031f
Successfully tagged kroki-builder-nomnoml:alpine
Successfully tagged kroki-builder-nomnoml:latest
Successfully tagged kroki-builder-nomnoml:0.6.1-alpine

The pkg error comes from the fact that I didn’t run npm install in the nomnoml directory because then theres is no node_modules with nomnoml if I don’t do that and it will never be in th container as it’s copied into the container. But if I run npm install before running make package in the nomnoml directory, the warning disappears but I still get the curl error I told about in the beginning. So it looks like there is a problem with nomnoml packaging.

Desired behaviour

  • nomnoml should be included in the container
  • The nomnoml service should answer a 200 HTTP code with a response body containing the SVG.

Host system information

$ cat /etc/*release
NAME="Arch Linux"
PRETTY_NAME="Arch Linux"
ID=arch
BUILD_ID=rolling
ANSI_COLOR="0;36"
HOME_URL="https://www.archlinux.org/"
DOCUMENTATION_URL="https://wiki.archlinux.org/"
SUPPORT_URL="https://bbs.archlinux.org/"
BUG_REPORT_URL="https://bugs.archlinux.org/"
LOGO=archlinux
$ node --version
v12.13.0
$ npm --version
6.12.0

Thanks in advance for your help.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:8 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
Mogzttercommented, Dec 13, 2019

I must have made a mistake when building/publishing the containers. I’ve just published a new version 0.0.10 and it’s working fine.

We should probably use the CI to build/publish the containers in order to avoid human errors 😉

1reaction
groovytroncommented, Nov 15, 2019

It’s strange I still get the same error in the container:

{"timestamp":"1573821469715","level":"ERROR","thread":"vert.x-eventloop-thread-0","mdc":{"error_message":"pkg/prelude/bootstrap.js:1185\n      throw error;\n      ^\n\nError: Cannot find module 'nomnoml'\n1) If you want to compile the packa
ge/file into executable, please pay attention to compilation warnings and specify a literal in 'require' call. 2) If you don't want to compile the package/file into executable and want to 'require' it from filesystem (likely plugin), specify an absolute p
ath in 'require' call using process.cwd() or process.execPath.\n    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:580:15)\n    at Function.Module._resolveFilename (pkg/prelude/bootstrap.js:1287:46)\n    at Function.Module._load (inte
rnal/modules/cjs/loader.js:506:25)\n    at Module.require (internal/modules/cjs/loader.js:635:17)\n    at Module.require (pkg/prelude/bootstrap.js:1166:31)\n    at require (internal/modules/cjs/helpers.js:22:18)\n    at Object.<anonymous> (/snapshot/app/i
ndex.js:0:0)\n    at Module._compile (pkg/prelude/bootstrap.js:1261:22)\n    at Object.Module._extensions..js (internal/modules/cjs/loader.js:710:10)\n    at Module.load (internal/modules/cjs/loader.js:598:32)\n (exit code 1)","path":"/nomnoml/svg","metho
d":"POST","action":"error","error_code":"500","failure_class_name":"java.lang.IllegalStateException"},"logger":"io.kroki.server.error.ErrorHandler","message":"An error occurred","context":"default","exception":"java.lang.IllegalStateException: pkg/prelude
/bootstrap.js:1185\n      throw error;\n      ^\n\nError: Cannot find module 'nomnoml'\n1) If you want to compile the package/file into executable, please pay attention to compilation warnings and specify a literal in 'require' call. 2) If you don't want 
to compile the package/file into executable and want to 'require' it from filesystem (likely plugin), specify an absolute path in 'require' call using process.cwd() or process.execPath.\n    at Function.Module._resolveFilename (internal/modules/cjs/loader
.js:580:15)\n    at Function.Module._resolveFilename (pkg/prelude/bootstrap.js:1287:46)\n    at Function.Module._load (internal/modules/cjs/loader.js:506:25)\n    at Module.require (internal/modules/cjs/loader.js:635:17)\n    at Module.require (pkg/prelud
e/bootstrap.js:1166:31)\n    at require (internal/modules/cjs/helpers.js:22:18)\n    at Object.<anonymous> (/snapshot/app/index.js:0:0)\n    at Module._compile (pkg/prelude/bootstrap.js:1261:22)\n    at Object.Module._extensions..js (internal/modules/cjs/
loader.js:710:10)\n    at Module.load (internal/modules/cjs/loader.js:598:32)\n (exit code 1)\n\tat io.kroki.server.action.Commander.execute(Commander.java:31)\n\tat io.kroki.server.service.Nomnoml.nomnoml(Nomnoml.java:70)\n\tat io.kroki.server.service.No
mnoml.lambda$convert$0(Nomnoml.java:54)\n\tat io.vertx.core.impl.ContextImpl.lambda$executeBlocking$2(ContextImpl.java:272)\n\tat io.vertx.core.impl.TaskQueue.run(TaskQueue.java:76)\n\tat java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecuto
r.java:1149)\n\tat java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)\n\tat io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)\n\tat java.lang.Thread.run(Thread.java:748)\n"}

And I get the following output when I build the container:

$ cd nomnoml
$ make package
docker build -f ops/docker/alpine/Dockerfile -t kroki-builder-nomnoml:alpine -t kroki-builder-nomnoml:latest -t kroki-builder-nomnoml:0.6.1-alpine .
Sending build context to Docker daemon  71.68kB
Step 1/10 : FROM node:10.15.0-alpine
 ---> 288d2f688643
Step 2/10 : RUN npm install -g pkg pkg-fetch
 ---> Using cache
 ---> 90cdd61e6d5a
Step 3/10 : ENV NODE node10
 ---> Using cache
 ---> a624dbdc66ca
Step 4/10 : ENV PLATFORM alpine
 ---> Using cache
 ---> 7c1905875633
Step 5/10 : ENV ARCH x64
 ---> Using cache
 ---> e9a231d32196
Step 6/10 : RUN /usr/local/bin/pkg-fetch ${NODE} ${PLATFORM} ${ARCH}
 ---> Using cache
 ---> 791929534cc9
Step 7/10 : COPY index.js package.json package-lock.json /app/
 ---> ef610606129b
Step 8/10 : WORKDIR /app
 ---> Running in 6047e7c5cd9e
Removing intermediate container 6047e7c5cd9e
 ---> 2a9806f192cf
Step 9/10 : RUN npm i
 ---> Running in 528aad1fb4e8
npm WARN kroki-nomnoml@1.0.0 No description
npm WARN kroki-nomnoml@1.0.0 No repository field.
npm WARN kroki-nomnoml@1.0.0 No license field.

added 201 packages from 107 contributors and audited 364 packages in 2.836s
found 0 vulnerabilities

Removing intermediate container 528aad1fb4e8
 ---> fdea18fa529b
Step 10/10 : RUN /usr/local/bin/pkg --targets ${NODE}-${PLATFORM}-${ARCH} . -o app.bin
 ---> Running in b17da9d38b39
> pkg@4.4.0
Removing intermediate container b17da9d38b39
 ---> e9fddc77a833
Successfully built e9fddc77a833
Successfully tagged kroki-builder-nomnoml:alpine
Successfully tagged kroki-builder-nomnoml:latest
Successfully tagged kroki-builder-nomnoml:0.6.1-alpine
Read more comments on GitHub >

github_iconTop Results From Across the Web

nomnoml - README
nomnoml provides an R interface to nomnoml.js, a tool for drawing sassy UML diagrams based on syntax with customizable styling.
Read more >
Support more diagrams in AsciiDoc and Markdown using Kroki
Use tasks to break down this issue into smaller parts. ... Wow, never even knew about kroki, what an interesting service!
Read more >
Line break for components - Stack Overflow
My PlantUML code looks like this ... Is there a way to force all packages after child2 to be below (line break) the...
Read more >
Simple Graphing Library with nice look and online features
I had thought that nomnoml syntax looked easy enough to work with, but I didn't realise you could define a map through a...
Read more >
Suport for PlantUML - Share & showcase - Obsidian Forum
Looks like plantuml has more diagrams and the documnetation on their web page isn;t broken. ... What about Mermaid's documentation is broken?
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