I updated schema files using forest schema:update command. It added new entries under model, forest and route directory. Refreshed the page and I got the collection listed on the UI after 5-10 second I get toast message again “A new version of your admin panel has been deployed. Please refresh your browser.” Once I refresh the page the new collection gets removed from the collection list
This happens everytime I restart my local server, collection is visible first then I get a message to reload and it gets removed.
Here a screenshot for error on console if I try to view the collection before refreshing the page again.
const express = require('express');
const { PermissionMiddlewareCreator } = require('forest-express-mongoose');
const { contents } = require('../models');
const router = express.Router();
const permissionMiddlewareCreator = new PermissionMiddlewareCreator('contents');
// This file contains the logic of every route in Forest Admin for the collection contents:
// - Native routes are already generated but can be extended/overriden - Learn how to extend a route here: https://docs.forestadmin.com/documentation/v/v6/reference-guide/routes/extend-a-route
// - Smart action routes will need to be added as you create new Smart Actions - Learn how to create a Smart Action here: https://docs.forestadmin.com/documentation/v/v6/reference-guide/actions/create-and-manage-smart-actions
// Create a Content
router.post('/contents', permissionMiddlewareCreator.create(), (request, response, next) => {
// Learn what this route does here: https://docs.forestadmin.com/documentation/v/v6/reference-guide/routes/default-routes#create-a-record
next();
});
// Update a Content
router.put('/contents/:recordId', permissionMiddlewareCreator.update(), (request, response, next) => {
// Learn what this route does here: https://docs.forestadmin.com/documentation/v/v6/reference-guide/routes/default-routes#update-a-record
next();
});
// Delete a Content
router.delete('/contents/:recordId', permissionMiddlewareCreator.delete(), (request, response, next) => {
// Learn what this route does here: https://docs.forestadmin.com/documentation/v/v6/reference-guide/routes/default-routes#delete-a-record
next();
});
// Get a list of Contents
router.get('/contents', permissionMiddlewareCreator.list(), (request, response, next) => {
// Learn what this route does here: https://docs.forestadmin.com/documentation/v/v6/reference-guide/routes/default-routes#get-a-list-of-records
next();
});
// Get a number of Contents
router.get('/contents/count', permissionMiddlewareCreator.list(), (request, response, next) => {
// Learn what this route does here: https://docs.forestadmin.com/documentation/v/v6/reference-guide/routes/default-routes#get-a-number-of-records
// Improve peformances disabling pagination: https://docs.forestadmin.com/documentation/reference-guide/performance#disable-pagination-count
next();
});
// Get a Content
router.get('/contents/\\b(?!count\\b):recordId', permissionMiddlewareCreator.details(), (request, response, next) => {
// Learn what this route does here: https://docs.forestadmin.com/documentation/v/v6/reference-guide/routes/default-routes#get-a-record
next();
});
// Export a list of Contents
router.get('/contents.csv', permissionMiddlewareCreator.export(), (request, response, next) => {
// Learn what this route does here: https://docs.forestadmin.com/documentation/v/v6/reference-guide/routes/default-routes#export-a-list-of-records
next();
});
// Delete a list of Contents
router.delete('/contents', permissionMiddlewareCreator.delete(), (request, response, next) => {
// Learn what this route does here: https://docs.forestadmin.com/documentation/v/v6/reference-guide/routes/default-routes#delete-a-list-of-records
next();
});
module.exports = router;
I can see on our end that we are received multiples schema
These 2 schemas are always in conflict (One adding a collection, then one remove it). Is it possible that your FOREST_ENV_SECRET is shared between multiples developers?
Facing issue with these two collections (added both of them recently):
model/content.js
// This model was generated by Forest CLI. However, you remain in control of your models.
// Learn how here: https://docs.forestadmin.com/documentation/v/v6/reference-guide/models/enrich-your-models
module.exports = (mongoose, Mongoose) => {
// This section contains the properties of your model, mapped to your collection's properties.
// Learn more here: https://docs.forestadmin.com/documentation/v/v6/reference-guide/models/enrich-your-models#declaring-a-new-field-in-a-model
const schema = Mongoose.Schema({
'answer': String,
'updatedAt': Date,
'type': String,
'question': String,
'createdAt': Date,
}, {
timestamps: false,
});
return mongoose.model('contents', schema, 'contents');
};
models/projects.js
// This model was generated by Forest CLI. However, you remain in control of your models.
// Learn how here: https://docs.forestadmin.com/documentation/v/v6/reference-guide/models/enrich-your-models
module.exports = (mongoose, Mongoose) => {
// This section contains the properties of your model, mapped to your collection's properties.
// Learn more here: https://docs.forestadmin.com/documentation/v/v6/reference-guide/models/enrich-your-models#declaring-a-new-field-in-a-model
const schema = Mongoose.Schema({
'createdAt': Date,
'users': { type: [Mongoose.Schema.Types.ObjectId], ref: 'users' },
'projectName': String,
'updatedAt': Date,
'projectAddress': String,
}, {
timestamps: false,
});
return mongoose.model('projects', schema, 'projects');
};
Yes I am able to view the records till the time collection is visible.
Hi @jeffladiray
No currently the secrect keys are just with me. And I’m running it on my local itself. I had initiated the process of deployment yesterday but did not complete because my admin backend url was not yet ready.
I can see an incomplete draft for new environment “Dev” under my project setting > environment page.