Erick Romero
Erick Romero10mo ago

Lucid library (cardano blockchain) fail to initialize

I am trying to initiliaze a library called lucid (npm install lucid-cardano) and it is erroring out- docs can be found here (https://lucid.spacebudz.io/). code that want to be implemented: < "use node" import { action } from "./_generated/server"; import { Blockfrost, Lucid } from "lucid-cardano"; export const doSomething = action({ handler: async () => {
const lucid = await Lucid.new( new Blockfrost("https://cardano-preprod.blockfrost.io/api/v0", "hdhdhddhdfhdhf"), "Preprod", );
}, }); > Error that i am getting: < Uncaught Failed to analyze _deps/node/KYCSLYXW.js: ENOENT: no such file or directory, open '/var/cardano_multiplatform_lib_bg.wasm' >
Blockfrost.io - Cardano API
We provide an instant and scalable Cardano API for free.
9 Replies
lee
lee10mo ago
sometimes the bundler can't detect all files you need to run certain npm packages, so it doesn't include files like .wasm read from the filesystem. To avoid this error, you can include lucid-cardano as an external dependency https://docs.convex.dev/functions/bundling#external-packages
Bundling | Convex Developer Hub
Bundling is the process of gathering, optimizing and transpiling the JS/TS
Erick Romero
Erick RomeroOP10mo ago
thnaks Lee, it worked! thanks Lee, i am just starting to use Convex, and i am encountering an early mistake. Within the same file i am trying to declare this mutation and action, but i am having a type error. what could be wrong? i could not figure it out. <> <import { action, mutation } from "./_generated/server"; import { v } from "convex/values"; export const doSomething = action({ args: { a: v.string() }, handler: async (ctx, args) => {
await ctx.runMutation(createTask, { text: args.a, }); return "success"; }, }); const createTask = mutation({ args: { text: v.string() }, handler: async (ctx, args) => { await ctx.db.insert("teste", { text: args.text });         },   });>
lee
lee10mo ago
when calling runMutation the first argument is a fully qualified function reference, like api.filename.createTask
Erick Romero
Erick RomeroOP10mo ago
ah ok got it. so for runMutatio is either internal or api for getting a fully qualified function reference. now it is working, thanks a lot HI, Lee, i have doubt regarding File Storage. Is there any difference between the follwoing two methods to obtain the url of a file stored at convex: 1. getting the URL using convex URL + storageID (convexURL/api/storage/{storageId} 2. getting the URL from ctx.storage.getUrl can i used them interchangably at my convenience? or is there points that i should take into consideration for each method?
lee
lee10mo ago
yes the difference is that (1) doesn't work. Was there any documentation you saw that indicated it would work? see https://discord.com/channels/1019350475847499849/1019350478817079338/1221216566977499136
Erick Romero
Erick RomeroOP10mo ago
Yeap. Take a look at this tutorial I saw. https://youtu.be/Vjtn9pWAZDI?si=B-n9EMFgVg092ooH
Web Dev Cody
YouTube
Building a Subscription Based SaaS with my Favorite Tech Stack (Nex...
This is a full stack tutorial video which includes a real time database (Convex) and authentication (Clerk) for helping youtube content creators get feedback on thumbnails. Both of these services helped sponsor this video, but I enjoy using both of them in my side projects as well because they give me a great developer experience and help me mo...
lee
lee10mo ago
yep that's the tutorial mentioned in @presley 's message sorry about the confusion
Erick Romero
Erick RomeroOP10mo ago
So does it work? Or should I only use the second method?
lee
lee10mo ago
it does not work, so you should only use the second method

Did you find this page helpful?