-1

I try to read json file data from s3 bucket with public access for parse data and display in a html table.

http.get<Post>('https://jsonfile/file.json').subscribe    (res => {   
      console.log(res);
    });

I have this error:

ERROR
HttpErrorResponse {headers: {…}, status: 0, statusText: "Unknown Error", url: null…}

This is my stackblitz: https://stackblitz.com/edit/angular-kwn1zg

cruano
  • 45
  • 1
  • 7

1 Answers1

2

This is most likey due to CORS issues. Find more information in this answer.

If you're using this URL it works:

https://cors-anywhere.herokuapp.com/https://temporal.s3.amazonaws.com/limites.json

http
  .get<Post>("https://cors-anywhere.herokuapp.com/https://temporal.s3.amazonaws.com/limites.json")
  .subscribe(res => {
    console.log(res);
  });

So you have to enable CORS for your S3 Bucket to solve this issue properly.

Philipp Kief
  • 8,172
  • 5
  • 33
  • 43