我有一個 api 一個域和其他域中的所有其他 api。所以在 SprtsAppConstatnts.js 中,我對所有域進行了硬編碼。當(dāng)我打印然后 formatUrl ---> 存在于 document.js 它打印哪個是正確的域然后 formatUrl ---> http://players.com/run/kit/?id=0900000000009009093292390230923其中 URL ===> 在文件 SportsResUtility.js 中打印出錯誤的域 URL ===> http://sports.com/tes/run/kit/?id=090000000009009093292390230923因為它exports.DATA_DNS_NAME = "http://sports.com";從文件 SprtsAppConstatnts.js 中獲取硬編碼值不確定如何在 SportsResUtility.js 中添加代碼,以便僅針對此路徑添加此域http://players.com我在服務(wù)器日志中顯示了兩個錯誤。不確定它來自哪個文件。 (node:30332) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: Can't set headers after they are sent.
(node:30332) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.有什么方法可以找出它來自哪個文件。我是否需要安裝任何其他軟件包進行調(diào)試。在下面提供我的代碼片段和沙箱SprtsAppConstatnts.jsexports.GET_JWT_TOKEN_URL = 'https://credentials.com';exports.DATA_DNS_NAME_CONTENT_CENTRAL = "http://players.com";// "http://usersports.com"; // "http://fddfdfdf.main.com:9080"; // dp-rest-apis-urlexports.DATA_DNS_NAME = "http://sports.com"; // "http://fddfdfdf.main.com:9080"; // dp-rest-apis-urlexports.CUST_MICRO_SVC_DNS_NAME = "http://fddfdfdf.main.com";exports.SERVICE_SERVER_DNS_NAME = 'http://sports.com';exports.REST_API_dfdfdfdf_DNS_NAME = 'https://dfdfdfdf.com';SportsResUtility.jsconst axios = require('axios');const SprtsAppConstatnts = require('../../constants/SprtsAppConstatnts');const credentials = require('../../internals/credentials.json');const authUtil = require('./AuthorizationUtil');module.exports ={ callService : (res, url, uri) => { var formatUrl; if(uri){ formatUrl = uri + url; } else{ formatUrl = SprtsAppConstatnts.DATA_DNS_NAME + url; }
來自節(jié)點 js 服務(wù)器的錯誤但不指向任何特定文件
白板的微信
2021-06-17 15:49:14