Closed teneko closed 3 years ago
Without a custom server created from your website, it won't work either:
get moralis(): Moralis {
if (this._moralis != null) {
return this._moralis;
}
this._moralis = moralis;
this._moralis.initialize(processEnvironmentVariables.MORALIS_APPLICATION_ID); // null, processEnvironmentVariables.MORALIS_MASTER_KEY
// this._moralis.serverURL = processEnvironmentVariables.MORALIS_SERVER_URL;
logger.debug("Moralis has been set and initialized");
return this._moralis;
}
The exception:
Moralis has been set and initialized
ParseError: XMLHttpRequest failed: {"UNSENT":0,"OPENED":1,"HEADERS_RECEIVED":2,"LOADING":3,"DONE":4,"readyState":4,"responseText":"","responseXML":"","status":410,"statusText":null,"withCredentials":false}
at handleError (C:\Users\<repo>\node_modules\moralis\lib\node\RESTController.js:427:15)
at processTicksAndRejections (internal/process/task_queues.js:93:5) {
code: 100
}
When doing it manually over the swagger interface in your website it works fine! I hope you can help. :)
get moralis(): Promise<Moralis> {
if (this._moralis != null) {
return this._moralis;
}
return this._moralis = new Promise(async (resolve, reject) => {
try {
const moralisFromModule = moralis as Moralis; // because moralis/node is not typed
moralisFromModule.initialize(processEnvironmentVariables.MORALIS_APPLICATION_ID); // processEnvironmentVariables.MORALIS_APPLICATION_ID, null, processEnvironmentVariables.MORALIS_MASTER_KEY
await moralisFromModule.User.logIn(processEnvironmentVariables.MORALIS_USER_EMAIL, processEnvironmentVariables.MORALIS_USER_PASSWORD);
// this._moralis.serverURL = processEnvironmentVariables.MORALIS_SERVER_URL;
logger.debug("Moralis has been set and initialized");
resolve(moralisFromModule);
} catch (error) {
reject(error);
}
});
}
After experimenting, log-in does not solve it. I have updated to 0.0.54:
Moralis has been set and initialized
ParseError: XMLHttpRequest failed: {"UNSENT":0,"OPENED":1,"HEADERS_RECEIVED":2,"LOADING":3,"DONE":4,"readyState":4,"responseText":"","responseXML":"","status":410,"statusText":null,"withCredentials":false}
at handleError (C:\Users\<repo>\node_modules\moralis\lib\node\RESTController.js:427:15)
at processTicksAndRejections (internal/process/task_queues.js:93:5) {
code: 100
}
MORALIS_APPLICATION_ID is the copied application-id copied from the swagger interface you can find under https://admin.moralis.io/web3Api.
I don't know how to run your code.
For this code:
async function x(){
return this._moralis = new Promise(async (resolve, reject) => {
try {
const moralisFromModule = require('moralis/node')
moralisFromModule.initialize("APP_ID");
moralisFromModule.serverURL = "SERVER_URL";
await moralisFromModule.User.logIn("a@b.c", "haha");
logger.debug("Moralis has been set and initialized");
resolve(moralisFromModule);
} catch (error) {
console.log(error);
reject(error);
}
});
}
x();
It looks like I get an expected Invalid username/password.
error;
MORALIS_APPLICATION_ID is the copied application-id copied from the swagger interface you can find under https://admin.moralis.io/web3Api.
Did you use the default api key as Application id?
MORALIS_APPLICATION_ID is the copied application-id copied from the swagger interface you can find under https://admin.moralis.io/web3Api.
Did you use the default api key as Application id?
Yes. I click on "Copy API Key" and click on "Default". Before that I have taken all the informations from the server you can just create. After the default-API-key approach didn't work out I tried to log-in me first, because I thought the application is maybe scoped to the account and not global. The login itself worked but the exception was just the same: ParseError: XMLHttpRequest
.
I don't know how to run your code.
For this code:
async function x(){ return this._moralis = new Promise(async (resolve, reject) => { try { const moralisFromModule = require('moralis/node') moralisFromModule.initialize("APP_ID"); moralisFromModule.serverURL = "SERVER_URL"; await moralisFromModule.User.logIn("a@b.c", "haha"); logger.debug("Moralis has been set and initialized"); resolve(moralisFromModule); } catch (error) { console.log(error); reject(error); } }); } x();
It looks like I get an expected
Invalid username/password.
error;
I do not set the server url explicitly when I just take use of the default application id. Can you elaborate what you mean?
Is this still an issue? (with the latest version of the SDK and server). I will close this issue, if it is still a problem, please provide the full error and code to replicate it on our forums, as we have more active support over there -> https://forum.moralis.io/
Assuming this
and this
I get an exception:
What am I doing wrong?