I was doing as the blockstack storage tutorial said, it works perfectly with hub.blockstack.org, but when I change the URL for Gaia Hub Connection to my own gaia hub url, it could perfectly store data, but it can’t get the data in aws s3 bucket, and the gaia displays something like below:
@nextonrgetFile() does not get processed by the Gaia hub. It uses URLs that start with read_url_prefix (which you can find with GET /hub_info on your Gaia hub).
In your case, getFile() fetches files directly from your S3 bucket. You won’t see them in the Gaia log file (but you will see them in your developer console in your browser).
And then I tried, but there seems to be an error fetching the file.
there might be another chance that I should fill the read_url_prefix with my gaia hub url? then I tried “http://localhost:XXXX/read/”(which is my private gaia hub url) and it fails again…
I don’t know what to write with read_url_prefix now…
I mean the url in my aws page is quite not unique, and I’m sure you can’t get the file using the url even if I set the access attribute of the file to public…
You’re not getting a HTTP 404 (a good sign), but the connection to S3 is timing out for you. Are you able to access public files in your S3 bucket? I’m able to read the file:
I’ve created another bucket in a different region which I’m sure this time I can use curl to get the content in the file without proxy, but still I get a timeout error…
It looks like it’s probably related to CORS errors — the AWS bucket is responding with too-restrictive of CORS settings. You can manually configure the CORS setting for your bucket from the AWS console, but the Gaia hub should probably also do this if it creates the bucket. Adding an issue for this on Github.
This is what I get when I try to fetch that URL from a browser console:
fetch("https://s3-ap-southeast-1.amazonaws.com/blockstacktest/1Q3k4VLgqWZ4BtUmCKJ3DcxyYWmpSMh4d5/statuses.json")
.catch(e => console.log(e))
12:1 Access to fetch at 'https://s3-ap-southeast-1.amazonaws.com/blockstacktest/1Q3k4VLgqWZ4BtUmCKJ3DcxyYWmpSMh4d5/statuses.json'
from origin 'https://forum.blockstack.org' has been blocked by CORS policy:
No 'Access-Control-Allow-Origin' header is present on the requested resource.
If an opaque response serves your needs, set the request's mode to 'no-cors' to
fetch the resource with CORS disabled.