CORS issue - Accessing my own gaia with aws cloud

Hi, We have set up our own gaia storage in the AWS cloud as per the document.

It is running successfully. Also, I am able to get hub_info from the browser (https://hub.blocksurvey.io/hub_info).

Problem is, When I am trying to get hub_info through the program, it gives CORS error. Attaching the screenshot for reference.

image

Followed this document to setup gaia,

Can you help me with this, if you have a quick answer or had a similar problem?

@jwiley @jude

@alejandro !
@ilayaperumal.raja alejandro works with us here at the foundation, he’s been digging into gaia and he’ll reachout to see what’s going on here.

1 Like

@jwiley, Thanks for your quick reply. @alejandro Please let me know if any configuration/setup needs to be changed for the CORS issue. Thanks in advance.

@ilayaperumal.raja it seems you followed and older version of the tutorial. Let me double check the steps, try it out myself and I’ll get back to you.

1 Like

@alejandro Hope you would have understood the problem in my gaia setup. Can you please help me with a new version of the tutorial?

There isn’t one yet. :slight_smile:

If you look at the current docs: https://docs.stacks.co there is no tutorial for this anymore. You are looking at older version of the site, and in the current site, the article you mention was removed. Not sure why someone removed it…

I want to follow the steps of the tutorial myself, verify it’s still valid and change anything that needs to get updated. I’ll let you know as soon as I finished it.

Ok, I finished the tutorial and now we have it again.

The old tutorial needed some changes (maybe that’s why it was removed), so I re-wrote it and modified the CloudFormation template to make it work again.
The new tutorial with the link to the new template is published here.

This however probably doesn’t fix your problem as you already had your hub setup.

I would recommend you look at two things that could fix the problem:

  1. The S3 policy is incorrect or wasn’t created.
    or
  2. Check what method you are using, and verify it is compatible. If you look at this gaia template file on lines 77 and 85 you will see:
add_header Access-Control-Allow-Methods "POST, OPTIONS";

and

add_header Access-Control-Allow-Methods "POST, OPTIONS";

so if you for example use a GET method it won’t get accepted.

Thanks for the tutorial. I followed the steps and created CloudFormation. EC2 instance and S3 bucket were launched successfully. But the server is not reachable by public DNS( ec2-34-238-27-123.compute-1.amazonaws.com).

Note, previous gaia setup is reachable by public DNS( ec2-54-83-90-103.compute-1.amazonaws.com).

I am passing the new gaia hub URL (https://hub.blocksurvey.io/) to stacks.js. Stacks is making a GET call to get hub_info.

I can show the demo of my gaia setup and configuration with stack.js. Feel free to email me [email protected]

@alejandro As I mentioned, still not able to set up my own Gaia.

Did you get a chance to take a look at this? Please help us to finish our setup.

Folowed updated setup guide EC2 instance and S3 bucket launched successfully. Looks like I have similar issue with access to hub_info

“Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://ec2-44-203-232-207.compute-1.amazonaws.com/hub_info. (Reason: CORS request did not succeed). Status code: (null).”

Thank you @igorkos104.id.blocks and @ilayaperumal.raja for reporting these issues.

I checked the cloudformation.yaml file and the problem was on lines 199-200

      SecurityGroupIngress:
        - IpProtocol: tcp
          FromPort: "22"
          ToPort: "22"
          CidrIp:
            Ref: SSHLocation

This was limiting the SSH access.

Please change it to:

      SecurityGroupIngress:
        - IpProtocol: tcp
          FromPort: "22"
          ToPort: "22"
          CidrIp: 0.0.0.0/0

Please make this change and try again.

I am currently updating the cloudformation.yaml file and the docs with this information and the new S3 template link. It should all updated in the next couple of hours.

@alejandro, I just tried again with updated cloudformation.yaml. But CORS issue still persists. I captured the video for reference. Please take a look,

Thanks,
Raja I

Thanks for your the video @ilayaperumal.raja .

As you say yourself your GAIA hub is working fine and responds on the browser.

What`s the application that you are running on port 4200?

@alejandro It is a localhost application. We are trying to interact with our Gaia storage through stacks.js. Actually, stacks.js is trying to connect with our Gaia hub. But it fails with CROS error.

@alejandro Were you able to find the problem? Why can BlockStack gub_info be fetched and not for BlockSurvey hub_info?

@ilayaperumal.raja, I’ll send you a private message to see if we can schedule a call.