No please see this
yes, that entire error looks to say that it was a not found error somewhere, maybe the cloud function tried to read a url
Moralis.Cloud.define(âgetNFTâ, async(request) => {
const logger = Moralis.Cloud.getLogger()
let NFTId = request.params.nftId;
let hexId = parseInt(NFTId).toString(16);
let paddedHex= (â0000000000000000000000000000000000000000000000000000000000000000â + hexId).slice(-64)
logger.info(paddedHex);
return Moralis.Cloud.httpRequest({url: âhttps://cr7ge1kve9u7.moralishost.com/{id}.jsonâ + paddedHex + â.jsonâ})
.then(function(httpResponse){
return httpResponse.text;
})
})
This is the function. It was working before
is that url accessible now?
what link you try to access there?
yes it works
I corrected this line
return Moralis.Cloud.httpRequest({url: âhttps://cr7ge1kve9u7.moralishost.com/{id}.jsonâ + paddedHex + â.jsonâ})
It is supposed to be
return Moralis.Cloud.httpRequest({url: âhttps://cr7ge1kve9u7.moralishost.com/â + paddedHex + â.jsonâ})
Still saying not found
you can log that url before trying to access it, to make sure has the right value
i did logger.info(httpResponse) but the same output even after restarting the server
2021-10-09T20:12:46.164Z - Error: [object Object]
at Object.resolveError (/moralis-server/lib/triggers.js:631:17)
at error (/moralis-server/lib/Routers/FunctionsRouter.js:107:32)
at processTicksAndRejections (internal/process/task_queues.js:95:5)
2021-10-09T20:12:46.157Z - Failed running cloud function getNFT for user undefined with:
Input: {"_ApplicationId":âEcXFhXVLhnGqUZNx9h8IyhtbZfwZCHYKbyIIlcZ3â,ânftIdâ:â1â}
Error: {âmessageâ:{âstatusâ:404,âheadersâ:{âdateâ:âSat, 09 Oct 2021 20:12:46 GMTâ,âcontent-typeâ:âtext/htmlâ,âtransfer-encodingâ:âchunkedâ,âconnectionâ:âcloseâ,âcf-cache-statusâ:âDYNAMICâ,âexpect-ctâ:âmax-age=604800, report-uri=âhttps://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ctââ,âreport-toâ:"{âendpointsâ:[{âurlâ:âhttps:\/\/a.nel.cloudflare.com\/report\/v3?s=d3laPWLOQ5H2QQMHRqhA9Rl6A45muB4k8MRJxAEkUJchxsoUNpkBE0l5j9lFtqemK7UnFeviT6u56AssboN7Uf3WPE%2FnSHmUGA%2Btf305Z1PmvsAr6rWlwF4KFiS01m01wsy%2FZQNwN8pLbGSJOHo%3Dâ}],âgroupâ:âcf-nelâ,âmax_ageâ:604800}",ânelâ:"{âsuccess_fractionâ:0,âreport_toâ:âcf-nelâ,âmax_ageâ:604800}",âserverâ:âcloudflareâ,âcf-rayâ:â69ba44044b231e81-AMSâ},âbufferâ:{âtypeâ:âBufferâ,âdataâ:[60,104,116,109,108,62,13,10,60,104,101,97,100,62,60,116,105,116,108,101,62,52,48,52,32,78,111,116,32,70,111,117,110,100,60,47,116,105,116,108,101,62,60,47,104,101,97,100,62,13,10,60,98,111,100,121,62,13,10,60,99,101,110,116,101,114,62,60,104,49,62,52,48,52,32,78,111,116,32,70,111,117,110,100,60,47,104,49,62,60,47,99,101,110,116,101,114,62,13,10,60,104,114,62,60,99,101,110,116,101,114,62,110,103,105,110,120,47,49,46,49,56,46,48,32,40,85,98,117,110,116,117,41,60,47,99,101,110,116,101,114,62,13,10,60,47,98,111,100,121,62,13,10,60,47,104,116,109,108,62,13,10]},âtextâ:"\r\n404 Not Found\r\n\r\n
404 Not Found
\r\nnginx/1.18.0 (Ubuntu)\r\n\r\n\r\n"},âcodeâ:141}
How do i clear the moralis log?
you should log the parameter to Moralis.Cloud.httpRequest
, to see what it tries to access there
the response to Moralis.Cloud.httpRequest is httpResponse correct?
logger.info(Moralis.Cloud.httpRequest)?
How do i clear the Moralis log, the same error has come up and the time zone is different from where I stay to the point I cannot make out if it is the latest error or no log
I think it ran once correctly
2021-10-09T20:23:51.296Z - Error: [object Object]
at Object.resolveError (/moralis-server/lib/triggers.js:631:17)
at error (/moralis-server/lib/Routers/FunctionsRouter.js:107:32)
at runMicrotasks ()
at processTicksAndRejections (internal/process/task_queues.js:95:5)
2021-10-09T20:23:51.291Z - Failed running cloud function getNFT for user undefined with:
Input: {"_ApplicationId":âEcXFhXVLhnGqUZNx9h8IyhtbZfwZCHYKbyIIlcZ3â,ânftIdâ:â1â}
Error: {âmessageâ:{âstatusâ:404,âheadersâ:{âdateâ:âSat, 09 Oct 2021 20:23:51 GMTâ,âcontent-typeâ:âtext/htmlâ,âtransfer-encodingâ:âchunkedâ,âconnectionâ:âcloseâ,âcf-cache-statusâ:âDYNAMICâ,âexpect-ctâ:âmax-age=604800, report-uri=âhttps://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ctââ,âreport-toâ:"{âendpointsâ:[{âurlâ:âhttps:\/\/a.nel.cloudflare.com\/report\/v3?s=giw7SQKxxwy2TVVc3EzQPv%2B6O3vanmUETSJk4oN8oMW6D0liYLDgNd1JR9XMsBhb2y9zWuJ32V%2BrVyE5ODzfxqeakZnWv2vjptEb8Q%2B7nw5%2Bl2lIEPLngyxj6MiSEt2VYl99qhQgWra2b2HKpa0%3Dâ}],âgroupâ:âcf-nelâ,âmax_ageâ:604800}",ânelâ:"{âsuccess_fractionâ:0,âreport_toâ:âcf-nelâ,âmax_ageâ:604800}",âserverâ:âcloudflareâ,âcf-rayâ:â69ba54416c8741ce-AMSâ},âbufferâ:{âtypeâ:âBufferâ,âdataâ:[60,104,116,109,108,62,13,10,60,104,101,97,100,62,60,116,105,116,108,101,62,52,48,52,32,78,111,116,32,70,111,117,110,100,60,47,116,105,116,108,101,62,60,47,104,101,97,100,62,13,10,60,98,111,100,121,62,13,10,60,99,101,110,116,101,114,62,60,104,49,62,52,48,52,32,78,111,116,32,70,111,117,110,100,60,47,104,49,62,60,47,99,101,110,116,101,114,62,13,10,60,104,114,62,60,99,101,110,116,101,114,62,110,103,105,110,120,47,49,46,49,56,46,48,32,40,85,98,117,110,116,117,41,60,47,99,101,110,116,101,114,62,13,10,60,47,98,111,100,121,62,13,10,60,47,104,116,109,108,62,13,10]},âtextâ:"\r\n404 Not Found\r\n\r\n
404 Not Found
\r\nnginx/1.18.0 (Ubuntu)\r\n\r\n\r\n"},âcodeâ:141}
2021-10-09T20:23:51.275Z - Ran cloud function getNFT for user undefined with:
Input: {"_ApplicationId":âEcXFhXVLhnGqUZNx9h8IyhtbZfwZCHYKbyIIlcZ3â,ânftIdâ:â0â}
Result: {âstatusâ:200,âheadersâ:{âdateâ:âSat, 09 Oct 2021 20:23:51 GMTâ,âcontent-typeâ:âapplication/jsonâ,âcontent-lengthâ:â138â,âconnectionâ:âcloseâ,âlast-modifiedâ:âTue, 05 Oct 2021 12:11:33 GMTâ,âetagâ:"â615c40f5-8aâ",âaccept-rangesâ:âbytesâ,âcf-cache-statusâ:âDYNAMICâ,âexpect-ctâ:âmax-age=604800, report-uri=âhttps://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ctââ,âreport-toâ:"{âendpointsâ:[{âurlâ:âhttps:\/\/a.nel.cloudflare.com\/report\/v3?s=TmmCLAWpZ93QRlDHkZrpOFpW97KjGwwGlWGjU%2ByTKJVyAzYLA%2Bm22O4KkRH%2FH4O0dS9FvBriCZPRbxq%2FKxFGeDPjX2KH9%2FIfZGqiDLq7PSd2cKa%2BbK4Y%2FWXKUL1cZ8sOm76OGIYh4lG12VcP7ZU%3Dâ}],âgroupâ:âcf-nelâ,âmax_ageâ:604800}",ânelâ:"{âsuccess_fractionâ:0,âreport_toâ:âcf-nelâ,âmax_ageâ:604800}",âserverâ:âcloudflareâ,âcf-rayâ:â69ba544158744c3e-AMSâ},âbufferâ:{âtypeâ:âBufferâ,âdataâ:[]},âtextâ:"{\n âimageâ:âhttps://xvndizkxt57v.moralisweb3.com/ngannou.pngâ,\n âdescriptionâ:ângannou vs jonesâ,\n ânameâ:âNgannou V Jones FRâ\n⌠(truncated)
I mean, instead of doing:
return Moralis.Cloud.httpRequest({url: âhttps://cr7ge1kve9u7.moralishost.com/â + paddedHex + â.jsonâ})
you should do:
x = âhttps://cr7ge1kve9u7.moralishost.com/â + paddedHex + â.jsonâ
logger.info(x);
return Moralis.Cloud.httpRequest({url: x})
so that you see what url it tries to access there.
yep, it looks like it run ok once from that log
why did it stop again ? I didnt change anything
I donât know, do you also send parameters to that cloud function? maybe only some ids work
how to clear the moralis log?
I donât know thatâŚ
Got it . It runs for the nft with the number 0.json but fails for 1.json becauseâŚwell i didnt make a 1.json yet. :P. Thanks
Iâm following this tutorial https://www.youtube.com/watch?v=tBMk1iZa85Y
at 42.00.
after listing the smart contract on OpenSea metadata on Moralis wasnât available and my server keeps deleting
You can create a separate thread for your problem, how did you set that metadata, how is that it wasnât available, what you mean by your server keeps deleting?