#[FIXED] Trouble with using the experimental form decorators

1 messages · Page 1 of 1 (latest)

cinder iris
#

Hi folks!

For a feature in our implementation we want to pre-parse the form state of a template before submission and recently I came a cross the Form Decorators feature, which seems to be able to do exactly that!

I was trying to get it to run, following the instructions to register the API factory and creating a form decorator, but I run into an error when starting Backstage after making these changes:

[1] ForwardedError [SyntaxError]: Feature loader created at '###/packages/backend/src/index.ts:20:49' failed; caused by SyntaxError: The requested module './next/api/FormFieldsApi.esm.js' does not provide an export named 'formFieldsApi'
[1]     at <anonymous> (###/node_modules/@backstage/backend-app-api/src/wiring/BackendInitializer.ts:580:17)
... <snip> ...
(###/node_modules/@backstage/backend-app-api/src/wiring/BackstageBackend.ts:38:12) {
[1]   cause: SyntaxError: The requested module './next/api/FormFieldsApi.esm.js' does not provide an export named 'formFieldsApi'

The absolutely mindboggling thing is, I can confirm the ./next/api/FormFieldsApi.esm.js file exists in my node_modules folder and also seems to exist in the repository for that specific version.

Commenting out the changes to app/src/apis.ts removes the issue, so it seems to be related to the actual scaffolder-react or scaffolder package(s).

We are currently running Backstage 1.46.3. Since our upgrades are managed by a different team, it's no trivial task to quickly upgrade to the latest version.

Would anyone have a clue how to resolve this issue?

cinder iris
#

Think I found the issue... I added a form decorator to one of our plugins and imported the decorator from that plugin package. Importing it from a common-library plugin seems to trigger the error. Moved the decorator directly into the /packages/app/src folder and the error is now gone.