Calling nft metadat via cloud function

ahh, very cumbersome but i think we are getting closer… below my log. the url seems to be wrong. any idea how it should look like?

2021-11-14T15:25:53.269Z - Ran cloud function getNFT for user undefined with:
  Input: {"_ApplicationId":"ePc0HyzXQdJ3ytVt8J4zhNDWS0WCFSANX6z87xIC","nftId":"1"}
  Result: undefined
2021-11-14T15:25:53.269Z - {"status":404,"headers":{"date":"Sun, 14 Nov 2021 15:25:53 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\"","server":"cloudflare","cf-ray":"6ae14147b9b1c2ef-FRA"},"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":"<html>\r\n<head><title>404 Not Found</title></head>\r\n<body>\r\n<center><h1>404 Not Found</h1></center>\r\n<hr><center>nginx/1.18.0 (Ubuntu)</center>\r\n</body>\r\n</html>\r\n","level":"info"}
2021-11-14T15:25:53.268Z -
2021-11-14T15:25:53.267Z - error
2021-11-14T15:25:53.262Z - Ran cloud function getNFT for user undefined with:
  Input: {"_ApplicationId":"ePc0HyzXQdJ3ytVt8J4zhNDWS0WCFSANX6z87xIC","nftId":"0"}
  Result: undefined
2021-11-14T15:25:53.261Z - {"status":404,"headers":{"date":"Sun, 14 Nov 2021 15:25:53 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\"","server":"cloudflare","cf-ray":"6ae14147ab6d4e1a-FRA"},"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":"<html>\r\n<head><title>404 Not Found</title></head>\r\n<body>\r\n<center><h1>404 Not Found</h1></center>\r\n<hr><center>nginx/1.18.0 (Ubuntu)</center>\r\n</body>\r\n</html>\r\n","level":"info"}
2021-11-14T15:25:53.260Z -
2021-11-14T15:25:53.257Z - error
2021-11-14T15:25:53.216Z - https://feciihxhdokr.usemoralis.com/0000000000000000000000000000000000000000000000000000000000000001.json
2021-11-14T15:25:53.215Z - 0000000000000000000000000000000000000000000000000000000000000001
2021-11-14T15:25:53.206Z - https://feciihxhdokr.usemoralis.com/0000000000000000000000000000000000000000000000000000000000000000.json
2021-11-14T15:25:53.205Z - 0000000000000000000000000000000000000000000000000000000000000000
2021-11-14T15:25:53.103Z - Ran cloud function getAllTokenIds for user undefined with:
  Input: {"address":"0xc638f3a8ecd0579f9e3a75693f87adc4c1357ffd","chain":"rinkeby"}
  Result: {"total":2,"page":0,"page_size":500,"result":[{"token_address":"0xc638f3a8ecd0579f9e3a75693f87adc4c1357ffd","token_id":"1","contract_type":"ERC1155","token_uri":"https://rmcpzgnm5yhv.usemoralis.com/0000000000000000000000000000000000000000000000000000000000000001.json","metadata":"{\n    \"image\": \"https://rmcpzgnm5yhv.usemoralis.com/photo.jpg\",\n    \"description\": \"New York City, Manhatten, Summer 2012\",\n    \"name\": \"A very dynamic city\",\n    \"external_url\": \"https://antonmartinsson.com/\"\n\n}","synced_at":"2021-11-06T13:28:51.727Z","amount":"2","name":null,"symbol":null},{"token_address":"0xc638f3a8ecd0579f9e3a75693f87adc4c1357ffd","token_id":"0","contract_type":"ERC1155","token_uri":"https://rmcpzgnm5yhv.usemoralis.com/0000000000000000000000000000000000000000000000000000000000000000.json","metadata":"{\n    \"image\": \"https://rmcpzgnm5yhv.usemoralis.com/artwork.png\",\n    \"description\": \"The art work of Lorian \",\n    \"name\": \"Lorian artwork\"\n}","synced_a... (truncated)

so this url gives me an error. what should i change here?

https://feciihxhdokr.usemoralis.com/0000000000000000000000000000000000000000000000000000000000000001.json

The url seems well formatted at first look. Did you upload those json files to your server with admin cli and deploy parameter?

2 Likes

yes i did. let me do it again to be double sure

resolved, thanks a lot @cryptokid. very good support.

1 Like

I see what u were trying to do, i probably would have trued to do the same with the for loop. But i guesse you dont need to set the url because thats just what the data is being gathered from so iguesse its like a pointer to the data so it will always point to whatever is at the url

1 Like