Closed jacobjohn-transitiv closed 2 years ago
Thanks for reporting this issue. However, you didn't provide sufficient information for us to understand and reproduce the problem. Can you setup a minimal repro please?
You can read here why this is needed. A good way to make a minimal repro is to create a new app via ng new repro-app
and adding the minimum possible code to show the problem. Then you can push this repository to github and link it here.
This might be related to your directory structure so its really important to get an accurate repro to diagnose this.
Thanks for your response @alan-agius4. I'll try to make a minimal repro shortly
Figured out the issue on my end. For those in a similar situation, here what's I did
The base url for all the api calls are stored on our env file and during the deployment process, the production tokens are replaced in azure (currently the prod env file base urls are tokens that get replaced during the deployment/release process in azure, such as #{base_url}
.
The task that handles the replacement of tokens looks for the files dist/browser/main-es2015.*.js
and dist/browser/main-es15.*.js
and does a find and replace. Since updating to 14, those files are no longer created and instead dist/browser/main.*.js
is created and used for the app.
These tokens were never replaced, so the base url got replaced by the host url, as it should, by angular's http. Once I updated the deployment config on azure to look for the correct main file, and not the differential loading files, the deployed app's api calls were functioning as it should.
This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
This action has been performed automatically by a bot.
π Bug report
Command (mark with an
x
)Is this a regression?
Yes, the previous version in which this bug was not present was: 9
Description
After updating our angular app from 9 to 14, stepwise, and fixing all the compilation errors, I was finally able to compile and run the app locally with
ng serve
. All network requests are functioning and pointed at the correct endpoints. When I build the app withnpm run build
which is"node --max_old_space_size=8000 ./node_modules/@angular/cli/bin/ng build --configuration production --base-href /app/ && npm run post-build"
and serve it locally, it appears that all my network requests request url's are being replaced with the host url. For example, my login endpoint should behttps://requestapi.com/login
but every single api call has a request url ashttp://localhost:4000/
. That's it, nothing append to the end of the url or anything. All the network requests work perfectly when I just dong serve
.π¬ Minimal Reproduction
package.json
angular.json
π₯ Exception or Error
I noticed this error in my command line when first loading the application from the build
π Your Environment
Let me know if anyone needs any more configs please.