"Unexpected error" when running smart action in preexisting NodeJs / Sequelize App

Found the solution by following a fresh FA setup, and adding the following code to my app:

  app.use(
    "/forest/authentication",
    cors({
      ...corsConfig,
      origin: corsConfig.origin.concat("null"),
    })
  );
  app.use(cors(corsConfig));

  app.use("/forest", (request, response, next) => {
    if (PUBLIC_ROUTES.includes(request.url)) {
      return next();
    }
    return ensureAuthenticated(request, response, next);
  });

The above code must be added before routes are added to the app.

Maybe some docs should be added for developers integrating FA to their already existing Node App.

1 Like