Raygun TypeError [ERR_INVALID_ARG_TYPE]



今天我决定用Raygun试验做一些实验。在安装了包和代理之后,每次向我的服务发出请求时,我都会收到错误。

[raygun-apm] Encountered an error building a trace:
TypeError [ERR_INVALID_ARG_TYPE]: The first argument must be of type string or an instance of Buffer, ArrayBuffer, or Array or an Array-like Object. Received undefined
at Function.from (buffer.js:333:9)
at Object.encodeUnicodeString (C:UsersGomboOneDriveDocumentsOrchard Consulting LLCWebService Developmentsap-shopifynode_modulesraygun-apmlibsrcprocess_profilebuffer_helpers.js:25:33)
at Object.CT_SQL_INFORMATION (C:UsersGomboOneDriveDocumentsOrchard Consulting LLCWebService Developmentsap-shopifynode_modulesraygun-apmlibsrcprocess_profilewire_protocolcommands.js:114:26)
at Object.eventsToMessages (C:UsersGomboOneDriveDocumentsOrchard Consulting LLCWebService Developmentsap-shopifynode_modulesraygun-apmlibsrcprocess_profilemessages.js:156:38)
at Object.<anonymous> (C:UsersGomboOneDriveDocumentsOrchard Consulting LLCWebService Developmentsap-shopifynode_modulesraygun-apmlibsrcprocess_profile.js:60:37) 
at Generator.next (<anonymous>)
at C:UsersGomboOneDriveDocumentsOrchard Consulting LLCWebService Developmentsap-shopifynode_modulesraygun-apmlibsrcprocess_profile.js:27:71
at new Promise (<anonymous>)
at __awaiter (C:UsersGomboOneDriveDocumentsOrchard Consulting LLCWebService Developmentsap-shopifynode_modulesraygun-apmlibsrcprocess_profile.js:23:12)
at Object.processProfile (C:UsersGomboOneDriveDocumentsOrchard Consulting LLCWebService Developmentsap-shopifynode_modulesraygun-apmlibsrcprocess_profile.js:44:12)
at processProfiles (C:UsersGomboOneDriveDocumentsOrchard Consulting LLCWebService Developmentsap-shopifynode_modulesraygun-apmlibsrcprofiler.js:180:27)
at wakeProfileProcessor (C:UsersGomboOneDriveDocumentsOrchard Consulting LLCWebService Developmentsap-shopifynode_modulesraygun-apmlibsrcprofiler.js:199:9)      
at C:UsersGomboOneDriveDocumentsOrchard Consulting LLCWebService Developmentsap-shopifynode_modulesraygun-apmlibsrcprofiler.js:238:13
at Generator.next (<anonymous>)
at fulfilled (C:UsersGomboOneDriveDocumentsOrchard Consulting LLCWebService Developmentsap-shopifynode_modulesraygun-apmlibsrcprofiler.js:40:32)

这是我的server.js

require('raygun-apm/http');
const express = require("express");
const dotenv = require("dotenv");
const cron = require("node-cron");
const bodyParser = require("body-parser");
require("body-parser-xml")(bodyParser);
const fulfillmentRouter = require("./routes/order/fulfillment");
const printRouter = require("./routes/order/print");
const invoiceRouter = require("./routes/order/invoice");
const shopifyRouter = require("./routes/order/shopifyOrder");
const rfidRouter = require("./routes/rfid/order");
const refundRouter = require("./cron/refund");
const payoutRouter = require("./cron/payout");
const timezoneRouter = require("./cron/timeUpdater");
const shipmentRouter = require("./routes/order/shipment");
const dhlExpressRouter = require("./routes/order/dhlExpress");
const errorHandler = require("./common/error");
dotenv.config();
const app = express();
app.use(
bodyParser.xml({
limit: "10mb",
})
);
app.use(
express.json({
limit: "10mb",
})
);
app.use("/shopify", shopifyRouter);
app.use("/order", fulfillmentRouter);
app.use("/label", printRouter);
app.use("/invoice", invoiceRouter);
app.use("/rfid", rfidRouter);
app.use("/shipment", shipmentRouter);
app.use("/dhl", dhlExpressRouter);
app.use(errorHandler);
cron.schedule("0 11 * * *", () => {
console.log("Refund Payment running...");
refundRouter.refundPayment();
});
cron.schedule("00 * * * *", () => {
console.log("Update DE Time");
timezoneRouter.updateDETime();
});
/*cron.schedule("0 9 * * *", () => {
console.log("Payout Payment running...");
payoutRouter.getPayouts();
});*/
const server = app.listen(process.env.PORT, console.log(`Server port ${process.env.PORT}`));
process.on("unhandledRejection", (err, promise) => {
console.log(`Error unhandledRejection : ${err.message}`);
// server.close(() => {
//   process.exit(1);
// });
});
process.on("uncaughtException", function (ex) {
console.log(`Error uncaughtException : ${ex.message}`);
// server.close(() => {
//   process.exit(1);
// });
});
process.once("SIGUSR2", function () {
process.kill(process.pid, "SIGUSR2");
});

shopifyRouter是我想使用的。下面是js上的一个简单的HTTP调用方法:

const express = require("express");
const Shopify = require("shopify-api-node");
const stores = require("../../config/stores.json");
const companies = require("../../config/slCompany.json");
const router = express.Router();
const {
shopifyLogger,
testLogger
} = require("../../common/logger");
const sqlConnection = require("../../common/sqlConfig");
const moment = require('moment');
const sl = require("../../common/httpCall");
const fs = require('fs');
const request = require("request-promise");
let cookie = '';
let testDBCookie = '';
router.get("/testSQL", async function (req, res) {
try {
var options = {
method: "GET",
uri: "https://timezone.abstractapi.com/v1/current_time/?api_key=550fcc1c13aa4907bcad3ef24e6c611d",
json: true,
};
options.uri += "&location=Berlin, Germany";
let berlinDate = await request(options);
currentDate = berlinDate.datetime.substring(0, 10);
let deDate = await sqlConnection.getQuery("55555555", "SELECT U_O_Date1 AS 'Date' FROM [@O_DATE1] WHERE Name='Germany'");
console.log(currentDate == deDate.recordset[0].Date.toISOString().substring(0, 10));
return res.status(400).json({
msg: "Success"
});
} catch (error) {
console.log("Update DATE Exception:", "Germany", error);
return res.status(400).json({
msg: "Failure"
});
}
});
module.exports = router;
如你所见,testSQL是一个简单的GET方法调用。什么好主意吗?

原来是MSSQL查询产生了这个错误。Raygun发布了一个新版本,它被修正了。

相关内容

  • 没有找到相关文章

最新更新