Elastic Beanstalk hosted React Application - Uncaught SyntaxError: expected expression, got '<'

Viewed 76

I recently pushed a new build onto elastic beanstalk and ran into the syntax error:

Uncaught SyntaxError: expected expression, got '<'

Error in Firefox

Error in Chrome

Here is how i'm serving the build using express:

app.use(express.static(path.join(__dirname, "client", "build")));
app.get('*', function(req, res) {
  res.sendFile(path.join(__dirname, "./client/", "build/index.html"));
});

It seems index.html is being served since the DOM gets populated. When I revert back to my old build the issue disappears. To recreate, I run:

npm run-script build
git add .
git commit -m ""
eb deploy

Once the new build is deployed onto Elastic Beanstalk, the syntax error shows up. The issue also does not appear when I run my express server locally and test the new build.

I've been stuck on this issue for quite a while now, any input is appreciated. Thanks!

0 Answers
Related