http.get returning null, but network log shows success

Discussão em 'Angular' iniciado por Chris Phillips, Fevereiro 17, 2025.

  1. I have a single angular application deployed two two separate azure web-apps. These apps get their environment variables from src/assets/config.json. This file is loaded on startup using this method:

    private loadConfiguration() {
    this.http.get<AppConfiguration>('assets/config.json').subscribe(data => {
    this.configration = data;
    this.$configuration.next(this.configration);
    });
    }


    In Env.A, the config file loads fine, and the app works as expected

    In Env.B, the config file fails to load. The network traffic shows a successful response when calling loadConfiguration(), and the response contains the expected contents of config.json, although the http.get() call is returning a null.

    I have confirmed that both applications have deployed the same artifact, and that the configuration of the app services are the same. I have confirmed that the config file is valid json, and I have confirmed that the property names are the same in both environments

    Continue reading...

Compartilhe esta Página