Bun project with node-canvas not working

origamingwastaken
HOBBY

a year ago

Hello, I'm trying to run a Discord Bot that uses node-canvas, but I'm getting some errors when it's running. Something to do with apt packages.

This is the repo: https://github.com/Communivents/ceramique

And the error:

149 |                     <:icons_dgreen:1274057371626377266>   **We will ask you to stop**

150 |                     <:icons_dyellow:1274056601065492511>   **You will get a warn**

151 |                     <:icons_Wrong:1274056876144721962>   **You will be banned from the server for 1 week**

152 |                     <:icons_ban:1274056903068094689>   **Permanent Ban**

153 | 

154 |                     After all, be nice <:m_Hug:1274056918284894313>`).setColor("#6246be")]}},Lo=[];for(let H of Object.keys(EZ))Lo.push({name:H,value:H});r2({data:new bH.SlashCommandBuilder().setName("embed").setDescription("Sends an embed by preset or json").setDefaultMemberPermissions(bH.PermissionFlagsBits.Administrator).addSubcommand((H)=>H.setName("json").setDescription("Send an embed from JSON").addStringOption((_)=>_.setName("embed").setRequired(!0).setDescription("JSON of the embed"))).addSubcommand((H)=>H.setName("preset").setDescription("Send an embed from a preset").addStringOption((_)=>_.setName("embed").setDescription("Preset embed to send").setRequired(!0).addChoices(...Lo))),async execute(H){const _=H.options.getString("embed");if(!_){H.reply(bH.blockQuote("Couldnt find the 'embed' string option."));return}switch(H.options.getSubcommand()){case"json":{const L=await H.channel?.send({embeds:[JSON.parse(_)]});H.reply({content:L?.url,ephemeral:!0});break}case"preset":{const L=Object.keys(EZ).find((N)=>N.toLowerCa



TypeError: libpixman-1.so.0: cannot open shared object file: No such file or directory

      at /$bunfs/root/ceramique:154:8989

      at /$bunfs/root/ceramique:2:685

      at /$bunfs/root/ceramique:154:9183

      at /$bunfs/root/ceramique:2:685

      at /$bunfs/root/ceramique:196:12

      at /$bunfs/root/ceramique:2:685

      at /$bunfs/root/ceramique:204:3997

      at /$bunfs/root/ceramique:2:685

      at /$bunfs/root/ceramique:204:16731

      at /$bunfs/root/ceramique:2:685

      at /$bunfs/root/ceramique:204:17011

      at /$bunfs/root/ceramique:2:814

      at /$bunfs/root/ceramique:205:4477

      at /$bunfs/root/ceramique:2:814

      at /$bunfs/root/ceramique:205:6662

      at /$bunfs/root/ceramique:2:814

      at /$bunfs/root/ceramique:205:7730

0 Replies

origamingwastaken
HOBBY

a year ago

e6306992-6a17-4995-84ea-cdbde3b351a7


origamingwastaken
HOBBY

a year ago

Fixed it, but now getting an error:

```
./dist/ceramique: symbol lookup error: /tmp/.17feeefffeffffcb-00000000.node: undefined symbol: _ZN2v816FunctionTemplate16InstanceTemplateEv

error: script "start" exited with code 127```


origamingwastaken
HOBBY

a year ago

And this now:

TypeError: /tmp/.7feefcbdbf4e4fbf-00000000.node: undefined symbol: _ZNK2v85Value8ToUint32ENS_5LocalINS_7ContextEEE


a year ago

This is a code issue, not an issue with Railway. You'll be better off Googling this than waiting for a response here


origamingwastaken
HOBBY

a year ago

I tested this on 3 machines and it doesn't work on railway so


origamingwastaken
HOBBY

a year ago

Also I looked at every post on google and tried everything


a year ago

This is during build?


origamingwastaken
HOBBY

a year ago

No, runtime


a year ago

Then it's a code error, sorry


origamingwastaken
HOBBY

a year ago

It uses a compiled .node file so the error may go un noticed during build


a year ago

If the error doesn't give enough information, I suggest logging more


origamingwastaken
HOBBY

a year ago

I don't control the build step of node-canvas…


a year ago

Did you not just say this is during runtime?


a year ago

As in, post build?


origamingwastaken
HOBBY

a year ago

The build step works: it creates a binding for cario.
Then when it is called, and only in railway, it crashes


origamingwastaken
HOBBY

a year ago

I tried my binary on Mac, linux and windows and in all scenarios it worked


a year ago

Found a couple Google results that may help, https://github.com/nodejs/docker-node/issues/277
https://github.com/Automattic/node-canvas/issues/1952

Add npm install ffi in your project, there's a missing binding


a year ago

I'm not super experienced at js so I likely won't be able to help further, but those threads should be a good starting point for you


origamingwastaken
HOBBY

a year ago

node-canvas is a mess


origamingwastaken
HOBBY

a year ago

I ended up bumping the library I use captcha-canvas to v3 so it uses skia-canvas instead


origamingwastaken
HOBBY

a year ago

Now no errors


origamingwastaken
HOBBY

a year ago

Thanks for helping 👍


a year ago

No prob


origamingwastaken
HOBBY

a year ago

Also using this dockerfile:

```dockerfile
FROM oven/bun:latest

RUN apt-get update && \
apt-get install -y libfontconfig1 libfontconfig1-dev

WORKDIR /app

COPY package.json bun.lockb biome.jsonc tsconfig.json ./
COPY src ./src
COPY scripts ./scripts

RUN bun install

CMD ["bun", "run", "start"]```