seatgeek / backstage-plugins

SeatGeek Backstage Plugins Collection
Apache License 2.0
34 stars 6 forks source link

[DOCS ][Okta Backend] Scheduled tasks fail with TypeError #49

Closed billabongrob closed 8 months ago

billabongrob commented 8 months ago

In the documents the scheduler mentions:

schedule: env.scheduler.createScheduledTaskRunner({
        frequency: { days: 1 },
      }),

This will result in an error such as:

] Backend failed to start up TypeError: Cannot use 'in' operator to search for 'cron' in undefined
[1]     at parseDuration (/app/node_modules/@backstage/backend-tasks/src/tasks/PluginTaskSchedulerImpl.ts:152:7)
[1]     at PluginTaskSchedulerImpl.scheduleTask (/app/node_modules/@backstage/backend-tasks/src/tasks/PluginTaskSchedulerImpl.ts:80:29)
[1]     at Object.run (/app/node_modules/@backstage/backend-tasks/src/tasks/PluginTaskSchedulerImpl.ts:112:20)
[1]     at OktaOrgDiscoveryEntityProvider.scheduleFn (/app/node_modules/@seatgeek/backstage-plugin-catalog-backend-module-okta/src/OktaOrgDiscoveryEntityProvider.ts:187:25)
[1]     at OktaOrgDiscoveryEntityProvider.connect (/app/node_modules/@seatgeek/backstage-plugin-catalog-backend-module-okta/src/OktaOrgDiscoveryEntityProvider.ts:181:16)
[1]     at <anonymous> (/app/node_modules/@backstage/plugin-catalog-backend/src/processing/connectEntityProviders.ts:108:23)
[1]     at Array.map (<anonymous>)
[1]     at connectEntityProviders (/app/node_modules/@backstage/plugin-catalog-backend/src/processing/connectEntityProviders.ts:103:15)
[1]     at CatalogBuilder.build (/app/node_modules/@backstage/plugin-catalog-backend/src/service/CatalogBuilder.ts:578:11)
[1]     at createPlugin (/app/packages/backend/src/plugins/catalog.ts:107:40)
[1]     at main (/app/packages/backend/src/index.ts:189:29)

Once another timeout is added, this works fine. As such:

      schedule: env.scheduler.createScheduledTaskRunner({
        frequency: { days: 1 },
        timeout: { minutes: 240 },
      }),

Not sure if Bug or not - will update README. (When time allows... lol)

zhammer commented 8 months ago

good find, surprised this doesn't throw a typescript error...