DEX code giving lot of error

Hi Guys,

I am trying to follow and create DEX using moralis code as available at below link.

But I am getting a lot of 32 errors. Pls help.

Access to XMLHttpRequest at 'https://y5o1gglcxtql.usemoralis.com:2053/server/functions/getPluginSpecs' from origin 'http://127.0.0.1:5500' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource.
y5o1gglcxtql.usemoralis.com:2053/server/functions/getPluginSpecs:1          

Failed to load resource: net::ERR_FAILED
favicon.ico:1          

Failed to load resource: the server responded with a status of 404 (Not Found)
index.html:1 

Access to XMLHttpRequest at 'https://y5o1gglcxtql.usemoralis.com:2053/server/functions/getPluginSpecs' from origin 'http://127.0.0.1:5500' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource.
y5o1gglcxtql.usemoralis.com:2053/server/functions/getPluginSpecs:1          

Failed to load resource: net::ERR_FAILED
index.html:1 

Access to XMLHttpRequest at 'https://y5o1gglcxtql.usemoralis.com:2053/server/functions/getPluginSpecs' from origin 'http://127.0.0.1:5500' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource.
y5o1gglcxtql.usemoralis.com:2053/server/functions/getPluginSpecs:1          

Failed to load resource: net::ERR_FAILED
index.html:1 

Access to XMLHttpRequest at 'https://y5o1gglcxtql.usemoralis.com:2053/server/functions/getPluginSpecs' from origin 'http://127.0.0.1:5500' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource.
y5o1gglcxtql.usemoralis.com:2053/server/functions/getPluginSpecs:1         

Failed to load resource: net::ERR_FAILED
index.html:1 Access to XMLHttpRequest at 'https://y5o1gglcxtql.usemoralis.com:2053/server/functions/getPluginSpecs' from origin 'http://127.0.0.1:5500' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource.
y5o1gglcxtql.usemoralis.com:2053/server/functions/getPluginSpecs:1          

Failed to load resource: net::ERR_FAILED
moralis.js:26472 

Uncaught (in promise) Error: XMLHttpRequest failed: "Unable to connect to the Parse API"
    at handleError (moralis.js:26472:15)
index.html:1 

Access to XMLHttpRequest at 'https://y5o1gglcxtql.usemoralis.com:2053/server/functions/getServerTime' from origin 'http://127.0.0.1:5500' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource.
y5o1gglcxtql.usemoralis.com:2053/server/functions/getServerTime:1          

Failed to load resource: net::ERR_FAILED
index.html:1 

Access to XMLHttpRequest at 'https://y5o1gglcxtql.usemoralis.com:2053/server/functions/getServerTime' from origin 'http://127.0.0.1:5500' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource.
y5o1gglcxtql.usemoralis.com:2053/server/functions/getServerTime:1         

Failed to load resource: net::ERR_FAILED
index.html:1 

Access to XMLHttpRequest at 'https://y5o1gglcxtql.usemoralis.com:2053/server/functions/getServerTime' from origin 'http://127.0.0.1:5500' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource.
y5o1gglcxtql.usemoralis.com:2053/server/functions/getServerTime:1          

Failed to load resource: net::ERR_FAILED
index.html:1 

Access to XMLHttpRequest at 'https://y5o1gglcxtql.usemoralis.com:2053/server/functions/getServerTime' from origin 'http://127.0.0.1:5500' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource.
y5o1gglcxtql.usemoralis.com:2053/server/functions/getServerTime:1          

Failed to load resource: net::ERR_FAILED
index.html:1 

Access to XMLHttpRequest at 'https://y5o1gglcxtql.usemoralis.com:2053/server/functions/getServerTime' from origin 'http://127.0.0.1:5500' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource.
y5o1gglcxtql.usemoralis.com:2053/server/functions/getServerTime:1          

Failed to load resource: net::ERR_FAILED
index.html:1 

Access to XMLHttpRequest at 'https://y5o1gglcxtql.usemoralis.com:2053/server/users' from origin 'http://127.0.0.1:5500' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource.
y5o1gglcxtql.usemoralis.com:2053/server/users:1          

Failed to load resource: net::ERR_FAILED
index.html:1 

Access to XMLHttpRequest at 'https://y5o1gglcxtql.usemoralis.com:2053/server/users' from origin 'http://127.0.0.1:5500' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource.
moralis.js:26329          

POST https://y5o1gglcxtql.usemoralis.com:2053/server/users net::ERR_FAILED
dispatch @ moralis.js:26329
setTimeout (async)
xhr.onreadystatechange @ moralis.js:26248
index.html:1 

Access to XMLHttpRequest at 'https://y5o1gglcxtql.usemoralis.com:2053/server/users' from origin 'http://127.0.0.1:5500' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource.
moralis.js:26329          

POST https://y5o1gglcxtql.usemoralis.com:2053/server/users net::ERR_FAILED
dispatch @ moralis.js:26329
setTimeout (async)
xhr.onreadystatechange @ moralis.js:26248
XMLHttpRequest.send (async)
dispatch @ moralis.js:26329
setTimeout (async)
xhr.onreadystatechange @ moralis.js:26248
index.html:1 

Access to XMLHttpRequest at 'https://y5o1gglcxtql.usemoralis.com:2053/server/users' from origin 'http://127.0.0.1:5500' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource.
moralis.js:26329          

POST https://y5o1gglcxtql.usemoralis.com:2053/server/users net::ERR_FAILED
dispatch @ moralis.js:26329
setTimeout (async)
xhr.onreadystatechange @ moralis.js:26248
XMLHttpRequest.send (async)
dispatch @ moralis.js:26329
setTimeout (async)
xhr.onreadystatechange @ moralis.js:26248
XMLHttpRequest.send (async)
dispatch @ moralis.js:26329
setTimeout (async)
xhr.onreadystatechange @ moralis.js:26248
index.html:1 Access to XMLHttpRequest at 'https://y5o1gglcxtql.usemoralis.com:2053/server/users' from origin 'http://127.0.0.1:5500' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource.
moralis.js:26329          

POST https://y5o1gglcxtql.usemoralis.com:2053/server/users net::ERR_FAILED
dispatch @ moralis.js:26329
setTimeout (async)
xhr.onreadystatechange @ moralis.js:26248
XMLHttpRequest.send (async)
dispatch @ moralis.js:26329
setTimeout (async)
xhr.onreadystatechange @ moralis.js:26248
XMLHttpRequest.send (async)
dispatch @ moralis.js:26329
setTimeout (async)
xhr.onreadystatechange @ moralis.js:26248
XMLHttpRequest.send (async)
dispatch @ moralis.js:26329
setTimeout (async)
xhr.onreadystatechange @ moralis.js:26248
index.html:1 

Uncaught (in promise) Error: A listener indicated an asynchronous response by returning true, but the message channel closed before a response was received

Hello due to this change, make sure you have updated the Moralis CDN link in index.html to:

https://unpkg.com/[email protected]/dist/moralis.js

If you have done this, make sure your Moralis server is awake - check from the admin interface and that you can access the database dashboard (from Database tab in server settings).

Thanks for your reply. I have already included update JS that and it allows metemask authentication. But it’s after that I am getting so many errors. Meanwhile, I refreshed my server and it is still loading past one day.

I have restarted your server now (it was down), can you check your app now (and your Moralis server dashboard).

It is still loading…

I have restarted your server again, can you check now. I see your server is using 1inch plugin - it’s recommended to use 1inch directly instead as plugins have now been discontinued and aren’t suitable anymore.

If you have not done much, you can delete this server and start with a new one without plugins (or uninstall it).

This error message indicates that there was a problem with the communication between the listener and the message channel. The reason is that sendMessage is now promisified internally, so you can ‘await’ it, but the by-product is that when you don’t specify a callback yourselves, it is added internally anyway in order for the call to return a Promise, which means that since you don’t call sendResponse in onMessage, the API will think that it was you who made a mistake of using a callback and not providing a response, and report it as such.

Since the new behaviour is very confusing for almost everyone, a solution might be to stop showing this error when the callback is not specified, however it might cause confusion for those developers who still use callbacks and forgot to call sendResponse inside onMessage by mistake, which should be reported ideally as it always was.

If you see your extension causing this errors - inspect closely all your onMessage listeners. Some of them probably need to start returning promises (marking them as async should be enough).

If still error showing, try disabled all installed extensions in Chrome then you will get a clear console without errors.

2 Likes

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.