Getting rid of "identifier expected" error in VSCode for rules

Auth0’s official documentation for rules recommends defining them in the following way:

function (user, context, callback) {
  context.idToken["http://mynamespace/hello"] = "world";
  console.log('===> set "hello" for ' + user.name);
  callback(null, user, context);
}

This anonymous function pattern shows up as an identifier expected. I could turn off the JS error checking, but I would love to leave it on to have VSCode check for any other possible errors.

Is there some other way to specify the function as a named function which would get rid of this error?

:wave: @sgronblo were you able to solve your issue in VSCode? Or would you like me to look into this for you?

Any idea how to solve this?

Hey there @aboo!

Have minimal experience with JS and no experience with VSCode but let me investigate it and get back to you with what I find!

I’ve set a function name for the main scrip and the error was resolved.

For example:

function myMethod(user, context, callback) {
  callback(null, user, context);
}

Glad you were able to eventually solved it and shared with community!

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.