Console still has an error:
Access to fetch at âhttp://localhost:3000/forestâ from origin âhttps://app.forestadmin.comâ has been blocked by CORS policy: Response to preflight request doesnât pass access control check: No âAccess-Control-Allow-Originâ header is present on the requested resource. If an opaque response serves your needs, set the requestâs mode to âno-corsâ to fetch the resource with CORS disabled.
I see that you configure your connexion only using a sequelize connection. Do note that the connection you want to provide to ForestAdmin should be initialised with the models you want to work with.
const sequelizeConnection = new Sequelize(
`postgres://admin:password@localhost:5432/postgres-qms-forest`
);
// Example of model definition
sequelizeConnection.define('User', {
// ... (attributes)
});
Hey @morganperre,
thank you for you help, I really appreciate that. However, I am still a bit confused.
In you interactive tutorial by setting up the backend, you are talking about connection.
Check this screenshot:
You are talking about "Connection that should be initialised"? What do you mean with that, please? Initialised can be each singe model, but not connection. Or I am wrong?
Connection is described here:
But according to that, connection canât be initialised.
Secondly, I also watched you video here: Express integration for Forest Admin
Could you please briefly tell me, what is done in 1min 12s of that video on that page? What exactly are you importing from the folder models?
Yes, I agree the wording is bad. Iâve already transmit your feedback to our team. So the connection is a sequelize instance with a working connection to a database and with all models (Creating an instance) you want to work with.
The connection you want to provide to ForestAdmin should be initialised with the models you want to work with. So you create a connection to your DB then you define models for this connection.
It the file that we use to handle connections and to define/import/require models (when you use the forest-cli those are automatically generated by making CRUD (introspection) on your DB).
I think your file âŚ/utils/db is meant to do the same in your case. Can your share the content of this file ?
Iâll give you a concret example I use myself.
1. A file that describe connections and load all models in the folder /models
models/index.js Here we define connections to the DB using environment variable DATABASE_URL_DEFAULT
thank you for you post. Unfortunately, I am new in sequelize and so it took me a couple of hours to figure out, that you simply use sequelize-cli that build that file structure for you. However, that is not the only way how to work with sequelize but probably the only way how to apply forest admin on sequelize.
You can recommend this video, that help me
So, I made some progress and forest admin somehow sees my models, but I am getting warning right now, that I am unable to authenticate. It seems like something should run on localhost:3310?
Morgan, I am pretty sure that you are trying to do your best, but your installation wizard is really confusing and this could discourage lot of people.
Let me explain you why.
When you are trying to create a new project, you are asked to create a name:
Everyone would assume, it must work right now, which is absolutely misleading. Nowhere is described that you also need to install forest backend that is accessible on the port 3310. This all is served by your great forest-cli, that creates server.js and necessary middlewares. It will never work without that, but it is not described anywhere.
As already mentioned in my previous post, you also require a specific modules structure that is provided by sequelize-cli, this can be also prepared by your forest-cli. That is such a pity you do not mention that anywhere in the installation wizard.
Nothing is even written about that in your documentation:
If you follow step-by-step this tutorial from scratch, you wonât definitely install forest admin, because the whole server part on port 3310 is missing.
I hope it does not sound just as critic, I just wanted to help you to stop loosing your customers.
Hi,
I guess I found the issue. In the step where people are allowed to choose the port, e.g. http://localhost:3000, it seems that only 3310 works anyway and your server is trying to approach this endpoint.
Sorry that you encounter some issue during the onboarding. We try to provide the smoothest experience for our users. So any constructed critics are welcomed !
Iâll try to be as clear as possible. There is 2 main way to integrate Forest Admin either by choosing a data source (eg. Postgress, MySQL, MongoDB âŚ) or what we call InApp (eg. Express/Sequelize, Express/Mongoose).
When choosing a data sources, the necessary files (also the sequelize one) are automatically generated.
When choosing the InApp youâre the one in charge to generate those files since you are integrating Forest Admin into an existing application. (but clearly we need to have a more mature documentation)
As you said, Iâm sure we can still improve the experience by smoothing those first steps.
Iâll forward your feedback right now to our team !
Thatâs not the intended behaviour ! Iâll try to reproduce on my side !
Thanks for all your feedbacks, itâs appreciable.
I tried to reproduce the issue, but Iâm not able to reproduce it.
Iâm wondering, how you ended up with the wrong endpoint. Can you share your project name ?
Also, why did you choose the Express / Sequelize datasource ? (Itâs important that we understand your need on this one and if the onboarding mislead you to choose this one against another simpler solution â project generated with the forest-cli when using postgres as a datasource)
As you see, there is this congratulation page, but I canât go further or click on anything.
Project is called: qms-test
When I just leave this page, go to my administration and enter the project again, everything is running properly already. But now, the server port does not make any difference. It works on both 3000 and 3310.
to your second question why I decided for Express / Sequelize. I didnât know that project based on sequelize using forest-cli will be created. And so I created Sequelize project on my own and then choosed this option.
Sorry, my mistake, I didnât realise I need to vote first
Otherwise, it would work.
Unfortunately, I canât reproduce that mistake, but now it works already. No matter, if I chose 3000 or 3310 port. So, maybe, I messed something up.
Nevertheless, I created my project from scratch as your proposed. Just created database and then used the choice âpostgressâ and not âexpress/sequelizeâ.