I'm having issues using my api key for the first time

Hello Fam, I’m trying to replicate the moralis Dex app on youtube but I’m having serious issues on the .env file where the moralis api key is required to work on the backend with …

I tried to run the command $ node index.js but I keep getting:

$ node index.js
bigint: Failed to load bindings, pure JS will be used (try npm run rebuild?)
Listening for API Calls

please any help will be appreciated…

do you get any error? or what doesn’t work?

from here it looks like it is working if it says Listening for API Calls

My script is working but my API KEY is not returning any object …. It just displays CANNOT GET on the browser

I don’t know what that means, can you provide more context?

above are three links to screenshots of my .env file containing my moralis API KEY and my git terminal below in the image with the error I’m facing and lastly the error I’m getting on the browser

Please can you stay online so we can easily solve this challenge

thank you so much for ur time

From the last screenshot it looks like accessing the url returns an error. What error it is? It is a specific error code? Do you see any error or log on the server side?

yes there’s an error even trying to access the tokenPrice page

here’s a full image below:

You get the same error even when no api key is set?

The error says that usdPrices is not defined.

What is the code that you are runnig?

The exact code used on the YouTube tutorial of moralis academy

can you post the link to that code?

okay sir
it’s on github
let me post a parent link:

I used this git to clone the project

I’ve tried to access the tokenPrice without my api key but I still cannot access the token prices same error even when I’ve my API KEY initialized in the .env script

by looking at the code, it looks like it is not going to work

const express = require("express");
const Moralis = require("moralis").default;
const app = express();
const cors = require("cors");
require("dotenv").config();
const port = 3001;

app.use(cors());
app.use(express.json());

app.get("/tokenPrice", async (req, res) => {
  return res.status(200).json(usdPrices);
});

that variable named usdPrices is not defined in that file

maybe the code from GitHub is not the complete one

okay
so what can I do right now ?

make sure your index.js looks the same as the one from the repo.

you can try to remove node_modules entirely and reinstall everything. Make sure you run npm install in the right directory do not cause dependency conflicts. If this doesn’t help try to run the command recommended by the error message npm run rebuild

You can find the full final project here. Please check if your code looks the same.

1 Like