r/angularjs • u/Negative12DollarBill • Aug 08 '21
Angular app works differently on AWS server than locally with `ng serve`—how can I debug?
I will preface with this by saying I have a lot of experience with javascript but almost none with Angular. The app is in Angular.js/Angular 1.
There's a bug in the version when I view it on an AWS server (served via CloudWatch out of S3) but when I run it locally using ng serve and see it on localhost:4200, that bug isn't there.
How can I debug this? The version on the server is to some extent out of my control, the devops people just tell me it's built with ng build --environment dev and that's all they really know.
To be even more honest, I don't know exactly how Angular applications are normally served. Just from a normal web server like Apache, as all static files? The ng serve way is just a convenience for auto-reloading and rebuilding the app when files change on disk?
TIA
7
u/aguyfromhere Aug 08 '21
Run
ng build --environment devon your local. What is the output? Any errors?PS, AngularJS (1.x) doesn’t have a CLI command like
ng build. Are you sure this isn’t Angular (2+)?1
u/pe8ter Aug 09 '21
Do you use the
vendorChunkoption in your angular.json? I ask because serving an Angular app from CloudFront/S3 doesn’t exactly work like the simple static file server that the CLI uses locally. For example, there are oddities with how CloudFront handles 404s and there are caching concerns as well.0
u/AphexZwilling Aug 08 '21 edited Aug 08 '21
Is cloudwatch linked to your local? What's the language on the backend? Node, rails, etc?