Are you sure you don’t have two calls ?
Every browser sends an OPTION request, maybe the all
button is not selected ?
Are you sure you don’t have two calls ?
Every browser sends an OPTION request, maybe the all
button is not selected ?
Hi @anon94532230, @didouche has been limited on the number of replies to the community! So I will answer (we are currently next to each other).
Here is the screenshot with the OPTION request:
Ok nice
Is your production running on multiple instances ? (are you using a load balancer for exemple)
Yes we use twin servers. One on port 6001, the other on port 6002 and switch from one to another.
But the strange thing is that the “authentication” issue suddenly appeared this afternoon without us putting anything in production on the servers… Any idea?
Um not really no, let me check what we released this afternoon in case it could break something
Did you release anything hat could break the authentication
Can you ping your server ? A 404 means it’s not reachable
We reloaded both servers and it now works again in production with Forest v5.
Unfortunately, in development we still have the authentication issue with Forest v7.
Here is the OPTION call for the development environment. Do you see anything?
I have the CORS issue with authentication on local machine.
I’m migrating from v2 to v7.
Options request passes normally, but the post fails and no logs on API side.
CORS options were setup as it was specified in the migration guide
Spent few hours and still no luck
Hello @koralex,
From what I can see, you don’t have a cors issue, you get a 404 on the route POST /forest/authentication
. It probably means that your project is not setup correctly.
Can you share with us the code of your agent, where you include and initialize forest-express-sequelize
?
Could you also remove the routes you added with the logs?
Yes, you’re right. It depends on the place where I put the app.use
for authentication endpoint.
I’m using a mongoose liana.
const Liana = require('forest-express-mongoose');
const users = require('./users');
const subscriptions = require('./subscription');
module.exports = async function () {
const app = this;
const Mongoose = app.get('Mongoose')
const mongoose = app.get('mongoose');
const liana = await Liana.init({
envSecret: process.env.FOREST_ENV_SECRET,
authSecret: process.env.FOREST_AUTH_SECRET,
objectMapping: Mongoose,
connections: {
default: mongoose
}
});
app
.use(liana)
.configure(users)
.configure(subscriptions)
};
If I remove logs middleware it remains the same, I just added it to ensure that the server receives the request.
I’m not sure to recognize the right pattern, and I’m not sure how this file is used at all.
As you’re making a big jump from v2 to v7, the simplest would be to refer to the archive I shared here. It contains the source code of a project I just created with forest-express-mongoose
.
You can refer to it to see how your code should be migrated, and the overall changes that have to be made.
The objectives, at the end, is that:
GET /forest
should return a 204 (empty response)POST /forest/authentication
should return a valid responseOk, the issue was related to the middleware that I have for non-existing endpoints, which throws 404.
Actually, it throws a 404 if response was not sent yet, which doesn’t work for forest endpoints, because it probably uses next()
, so that’s why it comes to the end.
This worked for us as well!
Thanks @koralex!
We had to comment these lines:
Hello @Arnaud_Moncel @anon94532230 !
We can launch forest in v7 and it works, thanks for your help !
Otherwise, we have the warning below several times in our logs, can you help us getting rid of them ?
[forest] 🌳🌳🌳 Cannot set the name value because of an unexpected error: Cannot set property name of [object Object] which has only a getter
Thank you !
Hello @didouche,
As the problem is different from the original issue you described, can you create a new thread?
Thanks