Can test/run but can't deploy (issue with sub-dependencies) [resolved]

I am getting this error:
Error deploying this script This script has not been deployed successfully because of the following errors:
job=01964ffd-6b1e-c4d6-8107-a66ecf4f3166 tag=bun worker=wk-default-bb951e044087-Jq0yF hostname=bb951e044087

bun install v1.2.4 (fd9a5ea6)
Resolving dependencies
Resolved, downloaded and extracted [2]
Saved lockfile
+ pdfjs-dist-legacy@1.0.1
+ windmill-client@1.483.1
4 packages installed [417.00ms]
14767 | const Canvas = require("canvas");
^
error: Could not resolve: "canvas". Maybe you need to "bun install"?
at /tmp/windmill/wk-default-bb951e044087-Jq0yF/01964ffd-6b1e-c4d6-8107-a66ecf4f3166/node_modules/pdfjs-dist-legacy/pdf.js:14767:28

Bun v1.2.4 (Linux x64 baseline)
Non-zero exit status for bun build: 1
job=01964ffd-6b1e-c4d6-8107-a66ecf4f3166 tag=bun worker=wk-default-bb951e044087-Jq0yF hostname=bb951e044087

bun install v1.2.4 (fd9a5ea6)
Resolving dependencies
Resolved, downloaded and extracted [2]
Saved lockfile
+ pdfjs-dist-legacy@1.0.1
+ windmill-client@1.483.1
4 packages installed [417.00ms]
14767 | const Canvas = require("canvas");
^
error: Could not resolve: "canvas". Maybe you need to "bun install"?
at /tmp/windmill/wk-default-bb951e044087-Jq0yF/01964ffd-6b1e-c4d6-8107-a66ecf4f3166/node_modules/pdfjs-dist-legacy/pdf.js:14767:28

Bun v1.2.4 (Linux x64 baseline)
Non-zero exit status for bun build: 1
Here is a top of my script for dependencies:
import * as wmill from "windmill-client";
import {getDocument, version} from "pdfjs-dist-legacy";
import type { DocumentInitParameters } from 'pdfjs-dist/types/src/display/api';
import * as wmill from "windmill-client";
import {getDocument, version} from "pdfjs-dist-legacy";
import type { DocumentInitParameters } from 'pdfjs-dist/types/src/display/api';
The goal of the script is to get pdf file and output it as a text, so I use pdf.js only to parse pdf. If in the script I add require("canvas") anywhere it deploys but it doesn't run. Aslo, it seems like even thought it says it didn't deploy I still can run the script. How to deal with that canvas dependencies in this case?
No description
2 Replies
rubenf
rubenf5d ago
add //nobundling at the top
Nick Kadutskyi
Nick KadutskyiOP5d ago
It worked! Thank you

Did you find this page helpful?