Home » Javascript » Aurelia http client works locally fails when deployed to azure

Aurelia http client works locally fails when deployed to azure

Posted by: admin November 1, 2017 Leave a comment

Questions:

I am using Visual Studio 2017 Community Edition, ASP.NET Core 1.1 and Aurelia using JSPM. I have the following http client call to retrieve a string. It works locally just fine. When I deploy to Azure app service the call never gets made. I never see the request in fiddler. Any insight would be appreciated. I have stepped through the JavaScript on Azure and it fails at xhr.onload
JS:

getReport(item, bcpId) {

    return new Promise((resolve, reject) => {

        return this.authService.authenticate()

            .then(authObj => {

                let url = item.uri;
                if (bcpId) {
                    url = `${url}?bcpId=${bcpId}`;
                }

                return this.http.createRequest(url)
                    .asGet()
                    .withHeader('Authorization', `Bearer ${authObj.token.access_token}`)
                    .send()

                    .then(response => {

                        let d = new Date();
                        let ds = moment(d).format('MM/DD/YYYY');
                        console.log('ds', ds);
                        let arrBuffer = this.base64ToArrayBuffer(response.response);
                        download(new Blob([arrBuffer]), item.title + '_'  + ds + item.extension, item.responseType);
                        resolve();

                    })

                    .catch(error => {

                        reject(error);

                    });

            })

            .catch(error => {

                reject(error);

            });

    });// Promise

}// getBCPReviewResultReport()

enter image description here

Answers: