Youâre not passing in date
into the Moralis API from your options. E.g.
const blockoptionsThirty = {
chain: 'Eth',
dateThirty: dateThirty,
};
That should be:
const blockoptionsThirty = {
chain: 'Eth',
date: dateThirty,
};
Youâre not passing in date
into the Moralis API from your options. E.g.
const blockoptionsThirty = {
chain: 'Eth',
dateThirty: dateThirty,
};
That should be:
const blockoptionsThirty = {
chain: 'Eth',
date: dateThirty,
};
That worked. thanks for the correction!
Hey, iâm having trouble getting the Moonbirds âLongest Avg Holdâ âLargest Bagâ and âHighest Avg Buy Inâ to display the correct numbers. Currently they are displaying âNaNâ. Iâm at 49:19 in the video.
I added some console.logs to hopefully help debug. would love some insight into where the error is.
async function getCol() {
const res = await axios.get("http://localhost:4000/", {
params: {slug: collection},
});
const data = res.data;
console.log("data",data);
console.log(âdataâ,data);
this prints: data Welcome to the server
const dataArray = Object.values(data);
console.log("dataArray",dataArray);
console.log(âdataArrayâ,dataArray);
this prints:
0: âWâ
1: âeâ
2: âlâ
3: âcâ
4: âoâ
5: âmâ
6: âeâ
etc. prints welcome to the server.
So I guess, it doesnât look like itâs retrieving the correct information from the correct page. I tried manually plugging in the slug etc. into the axios get request but the request gets caught in a promise. Been trying to figure this out for 3 days.
Anyone have insights into how to fix this?
So when I change it to include /collection I get
TypeError: Cannot read properties of undefined (reading âownersâ)
and
Uncaught (in promise)
AxiosError
code: âERR_BAD_RESPONSEâ
message: âRequest failed with status code 500â
In the headers object it says something like âcannot read properties of undefinedâ looks like it mentions âownersâ as well.
Iâm not seeing any use of owners
in Collection.js where the getCol
function is meant to be, can you post your current code.
If you are making your own changes, then more info is needed.
I updated some variable names for specificity (so I can understand them later), and added additional functionality to the stats.js (but that doesnât appear to be throwing the error).
Here is a link to the main files in github.
That owners error is happening on that collection?slug=0x235..
page? Make sure that address matches that collections address in index.js
.
Which page is this on now? You only posted fragments of the project so I can only make assumptions. Try restarting your server if the errors are intermittent.
Sorry about that. I actually just uploaded the full project to github. thatâs my fault. I restarted the server multiple times, the errors are persistent.
The issue is in your collectionsFile.js - you need to use the exact address set in the server:
slug: "0x23581767a106ae21c074b2276D25e5C3e136a68b"
to:
slug: "0x23581767a106ae21c074b2276d25e5c3e136a68b"
The comma wasnât the issue - have a close look at the differences between the two addresses. Copy exactly what you use in your Express index.js into your collectionsFile.js.
But yes, all working on my side after correcting this.
wow. humbling experience. didnât know the slug was case sensitive. thank you for the help! you are an expert!!
Hey in some cases my code is showing brackets instead of a number which is making my code return undefined and is ultimately cause issues in my dashboard. Am I doing something wrong? Is there any other way to address this other than filtering !== undefined, not sure if that will mess up my data?
Need more info - which changes have you made since the previous issue? Which file or code is this error coming from? Is this issue Moralis related?
showing brackets instead of a number
What do you mean by this? If it only happens in some cases, then which cases are these or is it random? You can do some debugging.
Sorry about that. Basically I restarted the whole project and decided to follow the project build exactly with the video. So the github repo should be basically exactly like the youtube video (aside from a few // notes that iâve written to myself).
I believe the error is happening in collection.js
I completed the video and here is my final repo. This âundefinedâ issue seems to be the only issue iâm having, i believe itâs trickling down to causing problems in the âsortâ feature as it crashes when I click to sort in descending etc.
Would love any insights you may have!
It is an issue with your dataArray
variable in your Collection component - some of the array items do not have an avgHold
property. So try to find out why this is - the data is initially coming from the fetch request to the Express server.
const dataArray = Object.values(data);
console.log("dataArray", dataArray);
Thank you so much for your help. I checked the original server stats.js and was missing some logic.
All complete now! woo!