中文
← Errors

F_SYSTEM_MISSING_PROVIDER

Missing injection provider

An older func runtime could not find a provider for a constructor parameter.

Updated 2 weeks ago

Reproduction

This code was emitted by older func runtimes when a constructor requested an unregistered provider:

src/app.module.ts
import { Command, FuncModule, Handler, run } from 'func'

class RegistryClient {}

@Command({ name: 'publish' })
class PublishCommand {
  constructor(private registry: RegistryClient) {}

  @Handler()
  run() {}
}

@FuncModule({ commands: [PublishCommand] })
class AppModule {}

run(AppModule)

What this error means

The runtime metadata named a constructor dependency, but that provider was not available to the application. Current func versions resolve unregistered service parameters as undefined; the code remains public for compatibility with older versions.

How to fix it

Mark the dependency as a service and register it in the resolved module:

src/app.module.ts
import { FuncModule, Service } from 'func'

@Service()
class RegistryClient {}

@FuncModule({
  commands: [PublishCommand],
  services: [RegistryClient],
})
class AppModule {}

If the error comes from an old func release, update func after confirming its injection behavior is compatible with your application.