You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Javascript function making an api call to http://localhost:8080 vs https://app.mydomain.com #400
I have defined the following javascript function within my functsion.ts file:
/* global clearInterval, console, CustomFunctions, setInterval *//** * Calculate the Present Value of a Policy * @customfunction * @param deathBenefit Death Benefit * @param discountRate Discount Rate * @param policyTerm Policy Term * @returns The Present Value */exportasyncfunctioncalculate(deathBenefit: number,discountRate: number,policyTerm: number): Promise<string>{// let host = "https://app.mydomain.com"; // does work.lethost="http://localhost:8080";// does not work// let host = "http://ngrok...url"; // an Ngrok url pointing to my localhost:8080 does work// let host = "https://...-8080.inc1.devtunnels.ms"; // microsoft dev tunnels does not work.try{letrequest=newCalculateTermLifePresentValueRequest();request.setDeathBenefit(deathBenefit);request.setDiscountRate(discountRate);request.setPolicyTerm(policyTerm);letapi=newExcelServicePromiseClient(host);letresponse=awaitapi.calculateTermLifePresentValue(request);returnJSON.stringify(response.getResults().getBasicValue());}catch(e){console.error("Error:",e.code,e.message);// Detailed outputreturn`host: ${host}, ${JSON.stringify(e)}`;}}
Current behavior
When I spin up a local server at http://localhost:8080, and update the host to this local endpoint, the method fails with the following error:
host: http://localhost:8080, {"message":"Http response at 400 or 500 level, http status code: 0","stack":"E@https://localhost:3000/functions.js:2389:68\nY@https://localhost:3000/functions.js:2425:45\n@https://localhost:3000/functions.js:2423:197\nKb@https://localhost:3000/functions.js:2401:186\nO@https://localhost:3000/functions.js:2400:616\nzc@https://localhost:3000/functions.js:2411:412\nBc@https://localhost:3000/functions.js:2414:230\n@https://localhost:3000/functions.js:2412:254\n@https://localhost:3000/functions.js:2412:232","code":2,"metadata":{}}
Steps to Reproduce
To confirm that my server at http://localhost:8080 works, I created an Ngrok endpoint, to my host. And when using the public Ngrok as the host, the api call is made successfully.
Activity