Cors error when tried to display collecetions

Feature(s) impacted

cant show / hide collections

Observed behavior

when edit layout mode is active (1), we tried to show different collections, but each one receive CORS error.
the errors:
Access to fetch at ‘https://api.forestadmin.com/api/layout’ from origin ‘https://app.forestadmin.com’ has been blocked by CORS policy: Method PATCH is not allowed by Access-Control-Allow-Methods in preflight response.

PATCH https://api.forestadmin.com/api/layout net::ERR_FAILED

TypeError: Failed to fetch

Expected behavior

collections need to be shown / hidden

Context

  • Project name: “RebarAdmin”
  • Team name: “Operations”
  • Environment name: “Development | nissanlevy” and also “Staging”
  • Agent technology: (nodejs)
  • Agent (forest package) name & version: “forest-express-sequelize”: “^9.3.10”,
  • Database type: sql
  • Recent changes made on your end if any: didnt have

Hi @zigit_zigit,

Sorry for that.
I am looking at your issue right now.

Shohan

Hi @zigit_zigit ,

Do you have this snippet in your agent:

// Support for request-private-network as the `cors` package
// doesn't support it by default
// See: https://github.com/expressjs/cors/issues/236
app.use((req, res, next) => {
  if (req.headers['access-control-request-private-network']) {
    res.setHeader('access-control-allow-private-network', 'true');
  }
  next(null);
});
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.concat('null')
}));
app.use(cors(corsConfig));

yes, still dont work

Hello @zigit_zigit

I assume that this only happens on the PATCH https://api.forestadmin.com/api/layout ?
Which browser are you using ? since I am not able to reproduce.

hi dogan, google chrome

If you could share the exact version it could be helpful so that I can reproduce.

I can see anyway that the allowed methods do not include the PATCH in our backend configuration, I have released a fix adding the method, hopefully unlocking your issue.

could you try again ?

Hi, error is occurs
,
Access to fetch at ‘https://api.forestadmin.com/api/layout’ from origin ‘https://app.forestadmin.com’ has been blocked by CORS policy: Method PATCH is not allowed by Access-Control-Allow-Methods in preflight response.

using “forest-express-sequelize”: “^9.3.10”,

using “forest-express-sequelize”: “^9.3.10”,

I should have been more specific, I meant to ask the specific version of your browser. As this is an error happening between your browser and our server.

Could you share with me a screen capture of the complete PREFLIGHT request ? the request headers and the response headers (if they are present or not).

One lead could also be if you are using chrome extensions or particular chrome configuration, can you try in private navigation with all extensions disabled ?

You can also try with another browser like firefox which is not chromium based.

problem solve. it was one of my extensions, thank you!