Integration with FeathersJS

Hi guys! I’m trying to connect with a Feathers app through forest-express-mongoose. Models sync is working pretty well, but when trying to login to the endpoint http://localhost:3030/forest/authentication returns 404. I’m following the instructions here.

Currently I’m doing this:

// forest.js
const forest = require('forest-express-mongoose');

module.exports = function (app) {
  forest.init({
    envSecret: app.get('FOREST_ENV_SECRET'),
    authSecret: app.get('FOREST_AUTH_SECRET'),
    objectMapping: app.get('mongooseClient'),
    connections: { default: app.get('mongooseClient').connection },
  }).then((middleware) => app.use(middleware));
};

// app.js
const forest = require('./forest');
...
app.configure(mongoose);
app.configure(middleware);
app.configure(services);
app.hooks(appHooks);
app.configure(forest); // <--- Here setup
...

Context

  • Package Version: 8.4.3
  • Project Name: Videsk

Thanks!

Hello @matiaslopezd and welcome on our community forum !

Have you done something recently that could explain such a change? Recent upgrade? Have you been able to connect to your application previously?

Moreover you will maybe find some interesting informations about what is happening under the hood by reading this thread that have a common error as yours.

Thanks a lot for the information. :slight_smile:

Hello @lclisson thanks for your response!

In fact, is my first time trying to connect Forest Admin with Feathers. After a few tests, I continue to get 404 errors on every /forest endpoint. But I discover is because the middleware is complete asynchronous so it’s not attached correctly to routes.

So, I make my app start after the promise of Forest is complete, but now I’m getting a 500 error because it’s trying to fetch with the port 443 on 127.0.0.1.

Also, I tried with pure MongoDB connection, but Forest CLI returns me the following error after trying to log in:

❯ forest login
Click on "Log in" on the browser tab which opened automatically or open this link: https://app.forestadmin.com/oidc/confirm?user_code=XXXX-XXXX
Your confirmation code: XXXX-XXXX
× An unexpected error occurred. Please reach out for help in our Developers community (https://community.forestadmin.com/) or create a Github issue with following error: UnableToCreateApplicationTokenError: Unable to create an application token on Forest Admin 

I really want to use ForestAdmin also pay, but it’s really hard to start.

Thanks!