Cannot import external module @covalenthq/client-sdk
Could you please help me figure out this error:
This happens in fresh wasp 0.14 app with TypeScript.
I added
"@covalenthq/client-sdk": "^2.1.1"
into my package.json, and then added import { GoldRushClient } from "@covalenthq/client-sdk";
into one of the custom actions. After I run wasp start
, I'm getting error above9 Replies
Hi @pavelksg. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
----------------------
Hmm, I don't know enough to give you a confident answer yet. The error message suggests that the module '@covalenthq/client-sdk' does not provide an export named 'GoldRushClient'. This could mean that the 'GoldRushClient' is not exported by the '@covalenthq/client-sdk' module, or there might be an issue with how the module is being imported.
However, none of the knowledge sources provided mention the '@covalenthq/client-sdk' module or the 'GoldRushClient'. Therefore, I can't provide a specific solution based on the provided knowledge sources.
I would recommend checking the documentation of the '@covalenthq/client-sdk' module to ensure that 'GoldRushClient' is a valid export. If it is, there might be an issue with your project setup or the way you're trying to import the module.
You might also find it helpful to look at the Wasp documentation (https://wasp-lang.dev/docs) or ask for help in the Wasp community (https://discord.com/invite/rzdnErX).
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------
Sorry @pavelksg, I seem to be having a bit of trouble. Don't worry though, I've pinged my support and they will try to fix me up! :technologist:
Perhaps try again in 15mins?
Here is what I see in
node_modules/@covalenthq/client-sdk/dist/esm/index.js
and then this at the bottom:
export { ChainID, ChainName, GoldRushClient, bigIntParser, calculatePrettyBalance, isValidApiKey, prettifyCurrency };
Very strange, let me try to install it
I reproduced it, and it seems to be an issue with this specific package.
I'll get back to it in a minute, let me just answer other users first
Couldn't figure this out today. Strangely enough, this is the only package that's causing problems, but it works when building, and in the IDE, and only fails in runtime.
@pavelksg Which version of Node are you using?
@miho, could this have something to do with server bundling? Because my IDE says everything is fine (and autocompletes it), both when opening the user project and the
.wasp/out/server
project. I tried it with Node 18.x and node 20.x, same problem.
Perhaps you'll know what's up from the top of your headThanks for looking into it! Iām using 18.18. Also tried the weirdest suggestions from GPT-4o on what I can change in all configs including Vite, but nothing helped
I just confirmed it works in a clean, pure TypeScript with
target: "esnext"
in tsconfig.json
.
index.ts
:
package.json:
However I am able to break it by changing to "module": "esnext",
in tsconfig.json
here is an example repository that seem to be including this modules and should be working fine: https://github.com/covalenthq/goldrush-kit/blob/main/package.jsonWohooo @pavelksg, you just became a Waspeteer level 1!
Thanks! I tried that too, it's not the package itself, it's some kind of combination of our build process and the package. I'll try to look into it some more today. Let's also see what @miho has to say. Perhaps he has an idea
Lemme try it and I'll report back š
Running it with my Typescript starter produces the same error for me :/
I'll try to see what can I find out
The way I got it working:
I get
Invalid or missing API key (sign up at https://goldrush.dev/platform/apikey)
which is expected.
This is super weird for me. It should work in both cases, but something is off with their / our setup and something doesn't align as we expect. We'll investigate further.