[SOLVED] Self-hosting Parse Server unknown parameter: address issue

In backend I guess that is the error. And I guess that you don’t use Moralis v1 in backend

if this is the endpoint you want to use, it has only addresses parameter:

actually, there is no backend in this scenario.
moralis-v1 library adds address parameter and calls my self-hosted parse server directly from the frontend.
The validation on parse server fails and returns the error.

Is this an incorrect way of using moralis-v1 library?

that is the backend, the self hosted parse server

how are you calling that function in front end? with what parameters?

you say that you don’t add address parameter but somehow it is added automatically?

maybe it is an issue with moralis v1 sdk if it adds that address automatically, you can call directly the cloud function for getTokenMetadata with the expected parameters

Yeah, I think there are some incompatibilities between moralis-v1 sdk and parse server validations.

The same problem happens with Moralis.Web3API.storage.uploadFolder function as well. moralis-v1 sdk adds address parameter to the request and parse server validation returns unknown parameter error.

Moralis.Web3API.native.runContractFunction fails with function_name parameter although it was working fine earlier with Moralis cloud servers.

I have only experienced these so far, the same issue may apply for more APIs.

So, would Moralis consider fixing these issues within the libraries used by parse server or with another moralis-v1 SDK version? Or, shall I figure out my own workarounds?

Thanks,

it should be fixed now, you have to update parse-server-migration to latest version

seems like it is not working :frowning:

params parameter in all the cloud function definitions is changed to request in https://github.com/MoralisWeb3/Moralis-JS-SDK/blob/main/demos/parse-server-migration/src/cloud/generated/evmApi.ts , and apparently that’s why this error occurs.

For example for getTokenMetadata, the cloud function definition was Parse.Cloud.define("getTokenMetadata", async ({params, user, ip}: any) => { and changed as below:

const getTokenMetadataOperation = getOperation('getTokenMetadata');
Parse.Cloud.define("getTokenMetadata", async ({request, user, ip}: any) => {
  try {
    await beforeApiRequest(user, ip, 'getTokenMetadata');
    upgradeRequest(request, getTokenMetadataOperation);
    const result = await Moralis.EvmApi.token.getTokenMetadata(request);
    return result?.raw;
  } catch (error) {
    throw new Error(getErrorMessage(error, 'getTokenMetadata'));
  }
})

I tried changing request to params for test purpose and it worked fine.

you have a working version now?

I only tried for getTokenMetadata.

I changed the parse-server code at https://github.com/MoralisWeb3/Moralis-JS-SDK/blob/main/demos/parse-server-migration/src/cloud/generated/evmApi.ts as

const getTokenMetadataOperation = getOperation('getTokenMetadata');
Parse.Cloud.define("getTokenMetadata", async ({params, user, ip}: any) => {
  try {
    await beforeApiRequest(user, ip, 'getTokenMetadata');
    upgradeRequest(params, getTokenMetadataOperation);
    const result = await Moralis.EvmApi.token.getTokenMetadata(params);
    return result?.raw;
  } catch (error) {
    throw new Error(getErrorMessage(error, 'getTokenMetadata'));
  }
})

and it worked fine.

I think, this needs to be changed for all cloud function definitions in the same file.

Try again with the latest version. We didn’t another fix.

hey @cryptokid,
The new version works fine with getTokenMetadata, but it still has a problem with uploadFolder.

chain parameter is added automatically by moralis-v1 sdk, and parse-server validation fails with unknown parameter.

Also, parse-server validation still fails with unknown parameter error for Moralis.Web3API.native.runContractFunction when function_name parameter is used, although it was working fine earlier with Moralis cloud servers.

I’ll send the feedback to the team

we have a new fix now merged: https://github.com/MoralisWeb3/Moralis-JS-SDK/pull/956

1 Like

Hey @PWDev

Can you check again and confirm whether the fix is valid for the newest version of the SDK :grinning_face_with_smiling_eyes:

Hi guys,
getTokenMetadata and uploadFolder are working fine now.
But, apparently there is a new problem.

As far as I see, after the new changes, all the parameter names are converted to camel case in upgradeRequest function on parse server, and this causes incompatibility between my ABI and function parameters, that’s why runContractFunction fails now.

I’ll send this to the team again

this one should be fixed with this PR: https://github.com/MoralisWeb3/Moralis-JS-SDK/pull/961

Everything looks working fine now :+1:

Thanks guys,

1 Like