Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CLI export-dynamic-plugin fails after backstage update #1843

Closed
johanneswuerbach opened this issue Jun 26, 2024 · 1 comment
Closed

CLI export-dynamic-plugin fails after backstage update #1843

johanneswuerbach opened this issue Jun 26, 2024 · 1 comment
Labels
jira kind/bug Something isn't working status/triage

Comments

@johanneswuerbach
Copy link

johanneswuerbach commented Jun 26, 2024

Describe the bug

Trying the export a package with @janus-idp/[email protected] package export-dynamic-plugin --clean fails with an error after updating backstage using yarn backstage-cli versions:bump --release 1.27.7:

Error: Backend plugin is not valid for dynamic loading: it should either export a BackendFeature or BackendFeatureFactory as default export, or export a const dynamicPluginInstaller: BackendDynamicPluginInstaller field as dynamic loading entrypoint

Expected Behavior

@janus-idp/[email protected] package export-dynamic-plugin --clean should work as before.

Debugging

There has been an upstream change backstage/backstage#25098, which is potentially affecting the validate export detection logic of the CLI

export function isValidPluginModule(pluginModule: any): boolean {
return (
isBackendFeature(pluginModule?.default) ||
isBackendFeatureFactory(pluginModule?.default) ||
isBackendDynamicPluginInstaller(pluginModule?.dynamicPluginInstaller)
);
}
function isBackendFeature(value: unknown): boolean {
return (
!!value &&
typeof value === 'object' &&
(value as any).$$type === '@backstage/BackendFeature'
);
}
function isBackendFeatureFactory(value: unknown): boolean {
return (
!!value &&
typeof value === 'function' &&
(value as any).$$type === '@backstage/BackendFeatureFactory'
);
}
.

Sadly this upstream change has been released as a patch release, so everyone locking to ^0.6.x will soon get this change.

Locking the version "@backstage/backend-plugin-api": "0.6.18" inside the package.json of the respective plugin fixes the build.

@gashcrumb
Copy link
Member

FYI this has been fixed by #2059, thanks @JessicaJHee

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
jira kind/bug Something isn't working status/triage
Projects
None yet
Development

No branches or pull requests

2 participants