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

http request and utils scaffolder backend is using deprecated ways of instantiating the plugin #1526

Open
nia-potato opened this issue Aug 2, 2024 · 14 comments
Labels
kind/bug Something isn't working

Comments

@nia-potato
Copy link

Currently when adding

backend.add(import('@roadiehq/scaffolder-backend-module-utils/new-backend'));
backend.add( import('@roadiehq/scaffolder-backend-module-http-request/new-backend'));

because of backstage/backstage#24493 we will be getting an deprecation notice of the below

The signature '(feature: (() => BackendFeature) | Promise<{ default: () => BackendFeature; }>): void' of 'backend.add' is deprecated.ts(6387)
index.d.ts(449, 8): The declaration was marked as deprecated here.


Current Behavior

when adding both http request and utils scaffolder backend plugins to index.ts they should not be deprecated

Steps to Reproduce

be on 1.29.2 of backstage, and install http request and utils scaffolder backend plugin.

Possible Solution

Context

Your Environment

  • @backstage/plugin-catalog-react version: ^1.12.2
  • @backstage/integration version: ^1.13.0
@nia-potato nia-potato added the kind/bug Something isn't working label Aug 2, 2024
@GersonTrj
Copy link

GersonTrj commented Aug 6, 2024

I see the same issue with: backend.add(import('@roadiehq/catalog-backend-module-okta/new-backend'));

@nia-potato do you have any updates on this issue?

@nia-potato
Copy link
Author

i was wondering if someone from roadie can take a look since they have more context than us.

maybe @Xantier

@Xantier
Copy link
Contributor

Xantier commented Aug 7, 2024

Is the warning message the issue here?

@nia-potato
Copy link
Author

I think the issue here is that because we are still using the deprecated ways of instantiating the plugins, by the next few releases, per the attached issue. they will stop working.

@swnia
Copy link

swnia commented Aug 21, 2024

@Xantier the way the plugins are initiated are now deprecated with version 1.30.0. Is there a plan to migrate these to the new way of instantiating backend plugins?

@Xantier
Copy link
Contributor

Xantier commented Aug 22, 2024

@Xantier the way the plugins are initiated are now deprecated with version 1.30.0. Is there a plan to migrate these to the new way of instantiating backend plugins?

@camilaibs maybe able to shed some more light into the timeline when these features will be removed. Deprecation at this point doesn't mean much because it is not introducing any breaking changes, just warnings. I trust CNCF has a solid plan on introducing breaking changes and removing existing functionality.

We will move these into the new system when it is necessary but if you want to move it now, a pull request would be welcomed.

@swnia
Copy link

swnia commented Aug 22, 2024

@Xantier Sorry, I was imprecise. In 1.30.0 the old way to instantiate backend plugins for the new backend system was removed...

I.e. I do get errors after upgrading.

packages/backend/src/index.ts:185:3 - error TS2345: Argument of type 'Promise<typeof import("[PATH]/backstage/src/node_modules/@roadiehq/scaffolder-backend-module-http-request/dist/new-backend")>' is not assignable to parameter of type 'BackendFeature | Promise<{ default: BackendFeature; }>'.
  Type 'Promise<typeof import("[PATH]/backstage/src/node_modules/@roadiehq/scaffolder-backend-module-http-request/dist/new-backend")>' is not assignable to type 'Promise<{ default: BackendFeature; }>'.
    Type 'typeof import("[PATH]/backstage/src/node_modules/@roadiehq/scaffolder-backend-module-http-request/dist/new-backend")' is not assignable to type '{ default: BackendFeature; }'.
      Types of property 'default' are incompatible.
        Type '() => BackendFeature' is not assignable to type 'BackendFeature'.
185   import('@roadiehq/scaffolder-backend-module-http-request/new-backend'),

@alexef
Copy link
Contributor

alexef commented Aug 22, 2024

same here. appreciate if anyone has a workaround

@Xantier
Copy link
Contributor

Xantier commented Aug 22, 2024

It could be an issue with the latest release, @freben is suggesting to // @ts-ignore this issue for now until they can identify the problem. https://discord.com/channels/687207715902193673/1034089724664610938/1276082713425743903

@alexef
Copy link
Contributor

alexef commented Aug 22, 2024

packages/backend/src/index.ts:62:13 - error TS2345: Argument of type 'Promise<typeof import("/Users/alex/work/stack/node_modules/@roadiehq/scaffolder-backend-module-utils/dist/new-backend")>' is not assignable to parameter of type 'BackendFeature | Promise<{ default: BackendFeature; }>'.
  Type 'Promise<typeof import("/Users/alex/work/stack/node_modules/@roadiehq/scaffolder-backend-module-utils/dist/new-backend")>' is not assignable to type 'Promise<{ default: BackendFeature; }>'.
    Type 'typeof import("/Users/alex/work/stack/node_modules/@roadiehq/scaffolder-backend-module-utils/dist/new-backend")' is not assignable to type '{ default: BackendFeature; }'.
      Types of property 'default' are incompatible.
        Type '() => BackendFeature' is not assignable to type 'BackendFeature'.

62 backend.add(import('@roadiehq/scaffolder-backend-module-utils/new-backend')); // @ts-ignore

ts-ignore doesn't seem to help with utils

@alexef
Copy link
Contributor

alexef commented Aug 22, 2024

nevermind, I should have added it the line before. works

@camilaibs
Copy link

@Xantier the way the plugins are initiated are now deprecated with version 1.30.0. Is there a plan to migrate these to the new way of instantiating backend plugins?

@camilaibs maybe able to shed some more light into the timeline when these features will be removed. Deprecation at this point doesn't mean much because it is not introducing any breaking changes, just warnings. I trust CNCF has a solid plan on introducing breaking changes and removing existing functionality.

We will move these into the new system when it is necessary but if you want to move it now, a pull request would be welcomed.

Here is what is recommended for now, adding @Rugvip to the loop 🙂 :
https://discord.com/channels/687207715902193673/1034089724664610938/1276494233263669330

@Rugvip
Copy link
Contributor

Rugvip commented Aug 23, 2024

@Xantier bumping @backstage/backend-plugin-api to ^0.7.0 in the affected packages will fix the issue

@Rugvip
Copy link
Contributor

Rugvip commented Aug 23, 2024

In fact, even bumping to the latest version of ^0.6.0 in this repo should fix it too. The issue is that earlier versions of 0.6.x are inlining incompatible types in the published package. Later versions of 0.6.0 will instead export a BackendFeatureCompat type that works with the newer backends. In case you don't want to bump all the way to ^0.7.0

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

No branches or pull requests

7 participants