Undefined is not a function
Posted: Mon Apr 14, 2025 11:20 pm
Hello everyone,
I'm having an issue with my script. I'm honestly just running test scripts but regardless if I'm putting in one that I thought would work or the actual script I want to be apart of the flow, I'm still running into the same error: "undefined is not a function." I've also tried the async version too and that also returned the exact same error. Can someone help me PLEASE because this is driving me insane!
"var fs = require("fs");
function jobArrived(s, flowElement, job) {
try {
s.log(1, "Script loaded successfully.");
var inputPath = job.getPath();
s.log(1, "Input path: " + inputPath);
var outputPath = inputPath + ".txt";
fs.writeFileSync(outputPath, "Hello from Classic Switch Script!");
job.sendToSingle(outputPath);
} catch (err) {
s.log(1, "Full error: " + JSON.stringify(err));
job.fail("Test script failed: " + err.message);
}
}"
I'm having an issue with my script. I'm honestly just running test scripts but regardless if I'm putting in one that I thought would work or the actual script I want to be apart of the flow, I'm still running into the same error: "undefined is not a function." I've also tried the async version too and that also returned the exact same error. Can someone help me PLEASE because this is driving me insane!
"var fs = require("fs");
function jobArrived(s, flowElement, job) {
try {
s.log(1, "Script loaded successfully.");
var inputPath = job.getPath();
s.log(1, "Input path: " + inputPath);
var outputPath = inputPath + ".txt";
fs.writeFileSync(outputPath, "Hello from Classic Switch Script!");
job.sendToSingle(outputPath);
} catch (err) {
s.log(1, "Full error: " + JSON.stringify(err));
job.fail("Test script failed: " + err.message);
}
}"