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?