When I run the code below locally it works fine. When it is pushed to server (AWS Amplify) it fails to work correctly.
In the console there is an error:
ERROR Error: Invalid HTML: could not find <table>
Code:
this.http
.get("./assets/data/test.txt", { responseType: "text" })
.subscribe((data) => {
console.log(data);
});
When run locally the output is whatever text is inside the file. When run from the server the output is the HTML of the Angular app.
I tried different file names and response types before discovering that the HTML was being returned.
I am no expert with AWS but I once had a similar issue in which the following URL helped me. https://repost.aws/questions/QURxK3sj5URbCQ8U2REZt7ow/images-not-showing-in-angular-application-on-amplify
We did move our images in S3 but the solution of modifying amplify.yml seems a possible way to fix your issue.
Hope this helps fix your issue.