[SOLVED] Throw new Error(`Not supported operation ${operationName}`); ^ Error: Not supported operation getNFTTrades

Self Hosted Moralis\parse-server-migration\build\cloud\generated\evmApi.js:32
throw new Error(Not supported operation ${operationName});
^

Error: Not supported operation getNFTTrades
at getOperation (G:\Self Hosted Moralis\parse-server-migration\build\cloud\generated\evmApi.js:32:15)

function getOperation(operationName) {

const operation = common_evm_utils_1.operationsV2.find((o) => o.name === operationName);

if (!operation) {

    throw new Error(`Not supported operation ${operationName}`);

}

return operation;

}

this is code where i got error

Hey @sandesh_walunj,

did you make any changes to the code in the generated/evmApi? What steps did you take to produce this error?

i just followed the steps as you provide in your official website for making self moralis server.only make changes in .env file

Can you provide me with more specific resources you’re using? Give me a link for the docs that you’re using

https://v1docs.moralis.io/moralis-dapp/getting-started/self-hosting-moralis-server/local-environment-setup

Hey @sandesh_walunj,

Can you tell me which step are you stuck in specifically? Which command or action did you take that causes you to get that error?

i just copied my friends last year project and there he uses the MoralisServerUrl and application Id which moralis firstly provides in dapp server’s.
so i just made server by following instruction of self hosted server.
and replaces all .env file data with my data and run command npm run start and this error is occured…

I see.

By any chance did you run yarn gen:cloud or npm run gen:cloud? This command should help you to generate cloud functions to call the APIs

i entered npm run gen:cloud but not working i got same error

Can you copy the logs from the npm run gen:cloud? Would like to see the full logs from that command

sure,parse-server-migration> npm run gen:cloud

[email protected] gen:cloud
ts-node ./scripts/generateCloudCode.ts
this is log generated after runnning command

Hmmm looks like so no error in here?

So a file should be generated from this command do you see any?

i got same above error again as generated when running npm run start command

I mean do you see any files generated from running yarn gen:cloud? Can you see any getNFTTrades cloud function file?

This is not referring to when you run npm run start

no i don’t see any files generated from running yarn gen:cloud

That certainly is strange :thinking: that likely is the source of the issue, since the file is never generated, the getNFTTrades function never exist and thus get that error

Do you have your code for this stored in a repository somewhere? I can have a quick check on that

have you checked it what’s wrong with this code

Hi @sandesh_walunj

Can you try the solution from this post. It looks like a similar issue.

const jsonFile = new Moralis.File('file.json', {
        base64: btoa(JSON.stringify({ name, description, image: imageURL }))
});

thanks server is running now but in here btoa is deprecated so what willl be the code here now…?

You can also replace it with window.btoa(). both will work.