About running private gaia hub

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:

I think the url is not correct, is there something wrong with the getFile() API, or I miss some configuration?

@nextonr getFile() 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).

my file in aws appears to be like below:

but the url seems nothing special without regard to access key of aws. So I’m not sure if I should fill in the read_url_prefix with “https://s3-ap-southeast-1.amazonaws.com/blockstacktest/”…

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…

This seems to work: https://s3-ap-southeast-1.amazonaws.com/blockstacktest/1Q3k4VLgqWZ4BtUmCKJ3DcxyYWmpSMh4d5/statuses.json. That tells me that your read_url_prefix should be “https://s3-ap-southeast-1.amazonaws.com/blockstacktest/”. What was the error you saw when that was your read URL prefix?

after I click the sign in button in blockstack browser, I find that I could not fetch the file

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…

Thanks for posting the screenshot.

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:

$ curl -sL https://s3-ap-southeast-1.amazonaws.com/blockstacktest/1Q3k4VLgqWZ4BtUmCKJ3DcxyYWmpSMh4d5/statuses.json
[{"id":0,"text":"Dec. 16th, 2018 18:06","created_at":1544954896965}]

@jude Thank you very much, I guess I know the reason. Now I have to set up the proxy configuration because the GFW seems to block aws s3.

But I don’t know how to make the configuration? Can you show me how Gaia can use a proxy?

still, I can’t get it…So if I’m able to write to aws without proxy, why do I need a proxy to read from aws? That doesn’t make any sense…

plus, I can’t read from the url unless I use a proxy…

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…

what might be the problem?

Hey @nextonr

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.

Hello @aaron, thank you for the reply.

According to the configuration below, it doesn’t seem an CORS problem

This is what I get when I try to fetch that URL from a browser console:

  .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.

Thank you for your reply.
I’ve also tried the same code in Browser console, but I get this:

@aaron, ok, seems really the problem…

can you explain how to set gaia configuration in detail? cause I’ve got no idea how to set a permissive property for bucket in gaia…

Thank you very much!