# Keep getting "No change in apimap, nothing sent to Forest."

**URL:** <https://community.forestadmin.com/t/keep-getting-no-change-in-apimap-nothing-sent-to-forest/6552>\
**Category:** Help me!\
**Created:** [August 8, 2023, 10:52am UTC](https://community.forestadmin.com/t/keep-getting-no-change-in-apimap-nothing-sent-to-forest/6552 "2023-08-08T10:52:27Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![Alejandro\_Salazar](https://dub1.discourse-cdn.com/flex013/user_avatar/community.forestadmin.com/alejandro_salazar/32/6021_2.png) [@Alejandro\_Salazar](https://community.forestadmin.com/u/Alejandro_Salazar)\
**Post date:** [August 8, 2023, 10:52am UTC](https://community.forestadmin.com/t/keep-getting-no-change-in-apimap-nothing-sent-to-forest/6552/1 "2023-08-08T10:52:27Z")

</div>

## Feature(s) impacted

Re-generating the apimap when the local server re-starts

## Observed behavior

After changing a field, creating an action, deleting a field, I keep getting this message: No change in apimap, nothing sent to Forest. Which then means that my changes doesn’t get added to forest-schema, and then cannot see any changes on the website.

## Expected behavior

Apimap to be regenerated when making changes to a forest collection.

## Context

- Project name: fleks
- Environment name: local
- Agent (forest package) name & version: forest-express-sequelize: 8.5.14,
- Database type: PostgreSQL

---

<div class="post-metadata">

**Author:** ![GuillaumeGautreau](https://dub1.discourse-cdn.com/flex013/user_avatar/community.forestadmin.com/guillaumegautreau/32/557_2.png) [@GuillaumeGautreau](https://community.forestadmin.com/u/GuillaumeGautreau)\
**Post date:** [August 8, 2023, 11:13am UTC](https://community.forestadmin.com/t/keep-getting-no-change-in-apimap-nothing-sent-to-forest/6552/2 "2023-08-08T11:13:41Z")

</div>

Hello @Alejandro_Salazar,

I can see in our database that the latest change on your development environment has been made on August 3rd.

Can you check that the environment secret configured on your development environment ends with `64f`?

Also, can you provide us with the value of `NODE_ENV`? When its value is `production`, the schema is not automatically re-generated at startup.

Also, can you check the file `.forestadmin-schema.json` : does it contain your modifications?

---

<div class="post-metadata">

**Author:** ![Alejandro\_Salazar](https://dub1.discourse-cdn.com/flex013/user_avatar/community.forestadmin.com/alejandro_salazar/32/6021_2.png) [@Alejandro\_Salazar](https://community.forestadmin.com/u/Alejandro_Salazar)\
**Post date:** [August 8, 2023, 12:19pm UTC](https://community.forestadmin.com/t/keep-getting-no-change-in-apimap-nothing-sent-to-forest/6552/4 "2023-08-08T12:19:59Z")

</div>

Hi! thanks for your quick reply.

I can confirm my secret ends in 64f.

The value of NODE\_ENV is ‘testing’ (which is our local value).

And finally, no, .forestadmin-schema.json doesn’t contain any modification.

Is there a way (command or something else) that I can use to re-generate the .forestadmin-schema.json by-passing the checks?

---

<div class="post-metadata">

**Author:** ![GuillaumeGautreau](https://dub1.discourse-cdn.com/flex013/user_avatar/community.forestadmin.com/guillaumegautreau/32/557_2.png) [@GuillaumeGautreau](https://community.forestadmin.com/u/GuillaumeGautreau)\
**Post date:** [August 8, 2023, 12:54pm UTC](https://community.forestadmin.com/t/keep-getting-no-change-in-apimap-nothing-sent-to-forest/6552/5 "2023-08-08T12:54:36Z")

</div>

We will need to check every of these conditions, in order to find where the misconfiguration lies:

1. Agent must be restarted for the changes to be added to the schema
2. the environment variable NODE\_ENV must not be equal to `production`
3. the environment variable `FOREST_DISABLE_AUTO_SCHEMA_APPLY` must **NOT** be set
4. the directory containing the configuration of collections, smart actions and smart fields must be correctly referenced as `configDir` when calling `init` (1)

Could you share the skeleton of the file where the action and field are configured, and make sure that this file is correctly loaded?

(1): here is an example of my configuration:

```ts
  // In my case, this code lies in middlewares/forestadmin.js
  const Agent = require('forest-express-sequelize');

  app.use(await Agent.init({
    modelsDir: path.join(__dirname, '../models'),
    // It references a directory in the root folder
    configDir: path.join(__dirname, '../forest'),
    envSecret: process.env.FOREST_ENV_SECRET,
    authSecret: process.env.FOREST_AUTH_SECRET,
    objectMapping: sequelize.Sequelize,
    connections: { default: sequelize },
  }));

```

And the directory `forest` contains configuration files, for instance

```ts
// Content of forest/posts.js
const { collection } = require('forest-express-sequelize');

// This file allows you to add to your Forest UI:
// - Smart actions: https://docs.forestadmin.com/documentation/reference-guide/actions/create-and-manage-smart-actions
// - Smart fields: https://docs.forestadmin.com/documentation/reference-guide/fields/create-and-manage-smart-fields
// - Smart relationships: https://docs.forestadmin.com/documentation/reference-guide/relationships/create-a-smart-relationship
// - Smart segments: https://docs.forestadmin.com/documentation/reference-guide/segments/smart-segments
collection('posts', {
  actions: [{
    name: 'do-something'
  }],
  fields: [],
  segments: [],
});

```

---

<div class="post-metadata">

**Author:** ![Alejandro\_Salazar](https://dub1.discourse-cdn.com/flex013/user_avatar/community.forestadmin.com/alejandro_salazar/32/6021_2.png) [@Alejandro\_Salazar](https://community.forestadmin.com/u/Alejandro_Salazar)\
**Post date:** [August 8, 2023, 1:53pm UTC](https://community.forestadmin.com/t/keep-getting-no-change-in-apimap-nothing-sent-to-forest/6552/6 "2023-08-08T13:53:45Z")

</div>

We are using an old version, so we haven’t really used Agent to set up forest. But this is roughly how our config files look:

```javascript
const {
  ensureAuthenticated,
  PUBLIC_ROUTES,
} = require('forest-express-sequelize');

app.use(
  '/forest/authentication',
  cors({
    ...corsConfig,
    // The null origin is sent by browsers for redirected AJAX calls. We need to
    // support this in authentication routes because OIDC redirects to the
    // callback route
    origin: [...corsConfig.origin, 'null'],
  })
);

app.use(
  jwt({
    secret: process.env.FOREST_AUTH_SECRET,
    credentialsRequired: false,
  })
);

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

requireAll({
  dirname: path.join(__dirname, 'routes'),
  recursive: true,
  resolve: Module => app.use('/forest', Module),
});

requireAll({
  dirname: path.join(__dirname, 'middlewares'),
  recursive: true,
  resolve: Module => Module(app),
});

```

The config file hasn’t been updated for 3 / 4 years, and we updated to `forest-express-sequelize 8` a couple of months ago.

And this is our `middleware` folder:

```javascript
const Liana = require('forest-express-sequelize');
const chalk = require('chalk');
const { objectMapping, connections } = require('../models');

module.exports = async function (app) {
  app.use(
    await Liana.init({
      envSecret: process.env.FOREST_ENV_SECRET,
      authSecret: process.env.FOREST_AUTH_SECRET,
      objectMapping,
      connections,
    })
  );
};

```

Our `forest` collections are also in `forest` folder:

```javascript
// Content of forest/Baskets.js
const { collection } = require('forest-express-sequelize');

// This file allows you to add to your Forest UI:
// - Smart actions: https://docs.forestadmin.com/documentation/reference-guide/actions/create-and-manage-smart-actions
// - Smart fields: https://docs.forestadmin.com/documentation/reference-guide/fields/create-and-manage-smart-fields
// - Smart relationships: https://docs.forestadmin.com/documentation/reference-guide/relationships/create-a-smart-relationship
// - Smart segments: https://docs.forestadmin.com/documentation/reference-guide/segments/smart-segments
collection('Baskets', {
  actions: [],
  fields: [],
  segments: [],
});

```

---

<div class="post-metadata">

**Author:** ![GuillaumeGautreau](https://dub1.discourse-cdn.com/flex013/user_avatar/community.forestadmin.com/guillaumegautreau/32/557_2.png) [@GuillaumeGautreau](https://community.forestadmin.com/u/GuillaumeGautreau)\
**Post date:** [August 9, 2023, 8:53am UTC](https://community.forestadmin.com/t/keep-getting-no-change-in-apimap-nothing-sent-to-forest/6552/7 "2023-08-09T08:53:44Z")

</div>

Hello @Alejandro_Salazar,

Since the last message, I can see that you managed to update the schema that has been sent to Forest Admin with 2 changes:

1. First, add a relationship
2. Second, remove the relationship and remove the field `accessDeviceId`

I guess that you managed to fix you issue? Can you share how?

---

<div class="post-metadata">

**Author:** ![Alejandro\_Salazar](https://dub1.discourse-cdn.com/flex013/user_avatar/community.forestadmin.com/alejandro_salazar/32/6021_2.png) [@Alejandro\_Salazar](https://community.forestadmin.com/u/Alejandro_Salazar)\
**Post date:** [August 9, 2023, 9:05am UTC](https://community.forestadmin.com/t/keep-getting-no-change-in-apimap-nothing-sent-to-forest/6552/8 "2023-08-09T09:05:38Z")

</div>

Hey!

Not really. That was me modifying the schema manually to check if the issue was related with “sending” the schema or with generating the schema.

At the end, the issue seems to be that my forest-schema file doesn’t get generated when making a change. We are currently 3 devs with the same issue

---

<div class="post-metadata">

**Author:** ![GuillaumeGautreau](https://dub1.discourse-cdn.com/flex013/user_avatar/community.forestadmin.com/guillaumegautreau/32/557_2.png) [@GuillaumeGautreau](https://community.forestadmin.com/u/GuillaumeGautreau)\
**Post date:** [August 9, 2023, 9:34am UTC](https://community.forestadmin.com/t/keep-getting-no-change-in-apimap-nothing-sent-to-forest/6552/9 "2023-08-09T09:34:20Z")

</div>

I checked the code, and `NODE_ENV` needs to be either `dev` or `development` for the schema to be updated automatically.

---

<div class="post-metadata">

**Author:** ![GuillaumeGautreau](https://dub1.discourse-cdn.com/flex013/user_avatar/community.forestadmin.com/guillaumegautreau/32/557_2.png) [@GuillaumeGautreau](https://community.forestadmin.com/u/GuillaumeGautreau)\
**Post date:** [August 9, 2023, 9:54am UTC](https://community.forestadmin.com/t/keep-getting-no-change-in-apimap-nothing-sent-to-forest/6552/10 "2023-08-09T09:54:44Z")

</div>

For information, as this problem has been experienced by multiple users of `forest-express`-based libraries, I created [a PR](https://github.com/ForestAdmin/forest-express/pull/1015) to add warnings in the console when the schema is not updated because of the configuration.

This will be released on the last major version of `forest-express-sequelize` and `forest-express-mongoose`.

We are currently pushing for the usage of `@forestadmin/agent` to replace packages based on `forest-express`. In addition to providing a more explicit API for customizations, this package generates the schema and sends it to our servers, except if an explicit configuration property says the contrary.

---

<div class="post-metadata">

**Author:** ![Alejandro\_Salazar](https://dub1.discourse-cdn.com/flex013/user_avatar/community.forestadmin.com/alejandro_salazar/32/6021_2.png) [@Alejandro\_Salazar](https://community.forestadmin.com/u/Alejandro_Salazar)\
**Post date:** [August 14, 2023, 7:33am UTC](https://community.forestadmin.com/t/keep-getting-no-change-in-apimap-nothing-sent-to-forest/6552/11 "2023-08-14T07:33:29Z")

</div>

that seems to fix the issue, thanks a lot!

And great idea adding warnings in console 🙂
