Skip to content

🐛catalog-backend-module-keycloak: Cannot run in windows #2427

@sednus

Description

@sednus

Plugin Name

catalog-backend-module-keycloak

📜 Description

When attempting to run yarn dev after adding the plugin in backend's index.ts file. It throws the following error immediately after login process:

Error [ERR_UNSUPPORTED_ESM_URL_SCHEME]: Only URLs with a scheme in: file, data, and node are supported by the default ESM loader. On Windows, absolute paths must be valid file:// URLs. Received protocol 'c:'

👍 Expected behavior

It should attempt to retrieve the data from the configured keycloak's instance

👎 Actual Behavior with Screenshots

It crashes shortly after logging in, giving the following error:

[1] 2025-01-02T15:34:12.635Z catalog info Reading Keycloak users and groups class=KeycloakOrgEntityProvider taskId=KeycloakOrgEntityProvider:default:refresh taskInstanceId=00edcc78-8461-4e65-9240-f3dc2ef85585

[1] Error [ERR_UNSUPPORTED_ESM_URL_SCHEME]: Only URLs with a scheme in: file, data, and node are supported by the default ESM loader. On Windows, absolute paths must be valid file:// URLs. Received protocol 'c:'

[1]     at throwIfUnsupportedURLScheme (node:internal/modules/esm/load:217:11)

[1]     at defaultLoad (node:internal/modules/esm/load:109:3)

[1]     at ModuleLoader.load (node:internal/modules/esm/loader:670:12)

[1]     at ModuleLoader.loadAndTranslate (node:internal/modules/esm/loader:483:43)

[1]     at #createModuleJob (node:internal/modules/esm/loader:507:36)

[1]     at #getJobFromResolveResult (node:internal/modules/esm/loader:275:34)

[1]     at ModuleLoader.getModuleJobForImport (node:internal/modules/esm/loader:243:41)

[1]     at async onImport.tracePromise.__proto__ (node:internal/modules/esm/loader:546:25) {

[1]   code: 'ERR_UNSUPPORTED_ESM_URL_SCHEME'

[1] }

[0] webpack compiled successfully

[0] <i> [webpack-dev-server] Gracefully shutting down. To force exit, press ^C again. Please wait...

[1] Terminate batch job (Y/N)? yarn start-backend exited with code 1

[0] yarn start exited with code 1

👟 Reproduction steps

Follow steps in plugin's README.

  1. yarn workspace backend add @backstage-community/plugin-catalog-backend-module-keycloak
  2. add keycloak configuration using the new backend configuration
catalog:
 providers:
   keycloakOrg:
     default:
       baseUrl: https://<keycloak_host>
       loginRealm: ${KEYCLOAK_REALM}
       realm: ${KEYCLOAK_REALM}
       clientId: ${KEYCLOAK_CLIENTID}
       clientSecret: ${KEYCLOAK_CLIENTSECRET}
       schedule: # Optional (defaults to the configurations below if not provided); same options as in TaskScheduleDefinition
         # supports cron, ISO duration, "human duration" as used in code
         frequency: { minutes: 30 } # Customize this to fit your needs
         # supports ISO duration, "human duration" as used in code
         timeout: { minutes: 3 } # Customize this to fit your needs
  1. Register plugin in backend's index
const backend = createBackend();

/* highlight-add-next-line */
backend.add(
 import('@backstage-community/plugin-catalog-backend-module-keycloak'),
);

backend.start();
  1. run yarn dev to start the client

📃 Provide the context for the Bug.

[1] 2025-01-02T15:34:12.635Z catalog info Reading Keycloak users and groups class=KeycloakOrgEntityProvider taskId=KeycloakOrgEntityProvider:default:refresh taskInstanceId=00edcc78-8461-4e65-9240-f3dc2ef85585

[1] Error [ERR_UNSUPPORTED_ESM_URL_SCHEME]: Only URLs with a scheme in: file, data, and node are supported by the default ESM loader. On Windows, absolute paths must be valid file:// URLs. Received protocol 'c:'

[1]     at throwIfUnsupportedURLScheme (node:internal/modules/esm/load:217:11)

[1]     at defaultLoad (node:internal/modules/esm/load:109:3)

[1]     at ModuleLoader.load (node:internal/modules/esm/loader:670:12)

[1]     at ModuleLoader.loadAndTranslate (node:internal/modules/esm/loader:483:43)

[1]     at #createModuleJob (node:internal/modules/esm/loader:507:36)

[1]     at #getJobFromResolveResult (node:internal/modules/esm/loader:275:34)

[1]     at ModuleLoader.getModuleJobForImport (node:internal/modules/esm/loader:243:41)

[1]     at async onImport.tracePromise.__proto__ (node:internal/modules/esm/loader:546:25) {

[1]   code: 'ERR_UNSUPPORTED_ESM_URL_SCHEME'

[1] }

[0] webpack compiled successfully

[0] <i> [webpack-dev-server] Gracefully shutting down. To force exit, press ^C again. Please wait...

[1] Terminate batch job (Y/N)? yarn start-backend exited with code 1

[0] yarn start exited with code 1

👀 Have you spent some time to check if this bug has been raised before?

  • I checked and didn't find similar issue

🏢 Have you read the Code of Conduct?

Are you willing to submit PR?

Yes I am willing to submit a PR!

Metadata

Metadata

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions