Error during theme creation in fusionauth

92 Views Asked by At

I'm trying to create a theme in fusionauth using the javascript FusionAuthClient. Basically the idea is to clone the default theme and to simply override some of the templates.

this.fusionClient.retrieveThemes().then((response) => {
  return response.successResponse.themes[0].id;
}).then((defaultThemeId) => {
  // set this to instruct fusion to clone default theme
  request.sourceThemeId = defaultThemeId;
  request.theme.name = 'Some-Theme-Name';
  return this.fusionClient.createTheme('SomeCustomId', request);
}).then((response) => {
  this.context.themeId = response.successResponse.themes[0].id;
  // -> follows tenant creation etc.
});

The request body json is same as in the documentation here https://fusionauth.io/docs/v1/tech/apis/themes

When I execute this, after the fusionClient.createTheme('id', request) I get an error response

Error provisioning the security
{"statusCode":400,"errorResponse":{"fieldErrors":{"themeId":[{"code":"[couldNotConvert]themeId"}]}},"successResponse":null,"exception":null}

Where the themeId is the first argument passed to createTheme method I guess, what is wrong with it I've no idea. According to documentation, this argument is optional and I tried differen t values for it but with the same error as autcome. I don't see any exceptions in fusion's log.

Any ideas what happens and how to overcome this?

1

There are 1 best solutions below

4
On

Obviously there is a discrepancy in the documentation of the FusionAuthClient where it sais @param {?string} themeId (Optional) The Id for the theme. If not provided a secure random UUID will be generated. and it's not obvious that the string must be an UUID actually as it's given in the theme's API documentation here https://fusionauth.io/docs/v1/tech/apis/themes themeId [UUID]. So after I provided an uuid it went ok. It also works if null is provided but then the id is auto-generated.