Forest-express-mongoose doesn't work

Hi! I can’t run and work with data on my express app. Same problem I had with NestJS and forestadmin/agent.
I have latest version of forest-express-moongoose.

require("dotenv").config();

const express = require("express");
const app = express();

const forest = require("forest-express-mongoose");
const mongoose = require("mongoose");


(async () => {
  await mongoose.connect('mongodb://127.0.0.1:27017/test')

  app.use((req, res, next) => {
    console.log(`Req: ${req.method} - ${req.url}`);
    next();
  });

  app.use(
    await forest.init({
      authSecret: process.env.FOREST_AUTH_SECRET,
      envSecret: process.env.FOREST_ENV_SECRET,
      objectMapping: mongoose,
      connections: {
        default: mongoose.connection,
      },
    })
  );

  app.use(express.json());

  app.get("/", (req, res) => res.send("OK"));
  app.listen(8000, () => console.log("started"));
})();

What I get in admin panel:

Documentation is helpless for me. Does anybody has a working example repo with latest forest lib?

Hey @qqaazzxxsswweeffvv, and welcome to our community :wave:

Could you share:

  • Any relevant log (Either on the agent & the frontend, in the developer console)
  • Your project name, so I can check your configuration on our end?

Thanks in advance :pray:

Sure! Thank you so much! Here is the information you need :smiling_face:
Logs on login in forest admin:

[forest] 🌳🌳🌳  Your connections do not seem to have any models. Please check if your connections import your models.
[forest] 🌳🌳🌳  Checking need for apimap update...
started
[forest] 🌳🌳🌳  No change in apimap, nothing sent to Forest.
Req: OPTIONS - /forest/authentication
Req: POST - /forest/authentication

project name:
test_Fqsfqosjf

The funny thing, I found auth problem in another topic. And solution is APPLICATION_URL env. This is interesting :crazy_face:. The next step to figure out, where is my models…

Glad you found a solution to your issue.

Don’t hesitate to open a new thread if you encounter another one :+1:

Thank you so much! :smiling_face: