Good Day,
While running my workflow i suddenly got this error.
This job was working previously and i made no changes to the code. However after creating a new workflow with the same code it works fine.
I am running lightning via docker locally. Any idea as to what the cause of this would be?
Hey @Kiefer check out this Docs page on Run Status Codes. Given your screenshot error Unexpected token
, my guess is there is a syntax error in your job code. Maybe a character was missed or added if you copied/pasted from elsewhere?
Feel free to share your job code if you want another set of eyes to take a look and see if we can spot the issue.
This is the code i used. The job simply pulls the following data from a PSQL database.
Again the code worked previously and no changes were made to it.
sql(
state =>
'Select patientid,fk_cities, countryid_fk, pfirstname, pmiddlename, plastname, dateofbirth, genderid, address, healthdistrictid, telephone, personalid, title, professionid, placeofwork, email, vaccinationid, pcode from postgres.patients Order by patients.patientid ASC LIMIT 10; ', { writeSql: true });
//use “OFFSET to skip records to allow job to run faster”
fn(state => {
const patients = state.data;
console.log(state);
return {…state, patients};
});
Hi @Kiefer,
I am suspicious of the comment in your code:
//use “OFFSET to skip records to allow job to run faster”
Maybe it’s a formatting thing from the Community editor, but “
is not a valid Javascript character, which results in a syntax error. Try removing those quotes or using regular "
characters
Hey @Kiefer - Thanks for the call today to walk through your workflow issue. Has it popped up again?
Also, I think you said you’re on lightning v2.3.1
… this is a few versions behind. Can you please try upgrading to the latest version v2.4.6
to see if this corrects the issue?
FYI @jclark the weird thing was
- Even if Kiefer was had a plain old
fn(...)
job expression, the job was still crashing with an Unexpected token
error (see screenshot). But this issue was something wrong with this specific workflow!
- If Kiefer created a new workflow and copied over the exact job code over to the new workflow… it worked beautifully. Smells like bug.
Kiefer, I’ll share the video recording with the team… but I know they’ll advise that you get on the latest version of Lightning, so pls be sure to do that and then keep us posted if this pops up again. Thanks for your help sleuthing this!