I am getting this error from the /.constants. Why is this throwing an error for a constant?
Nest can't resolve dependencies of the NestKnexService (?). Please make sure that the argument NEST_KNEX_OPTIONS at index [0] is available in the NestKnexService context.
Potential solutions:
- If NEST_KNEX_OPTIONS is a provider, is it part of the current NestKnexService?
- If NEST_KNEX_OPTIONS is exported from a separate @Module, is that module imported within NestKnexService?
@Module({
imports: [ /* the Module containing NEST_KNEX_OPTIONS */ ]
})
Hi. For the future readers;
Error complains about NestKnexService can not resolve injected dependency. In this case the dependancy is NEST_KNEX_OPTIONS which is a custom provider. To make the dependency injection work, the provider needs to be registered in the knex module. NEST_KNEX_OPTIONS provider is not included in this article. It is included in github link author provided.
import { connectionFactory } from './nest-knex-connection.provider';
import { createKnexProviders } from './knex.providers';
@Global()
@Module({
providers: [
KnexService,
connectionFactory,
...createKnexProviders({/*...knex options*/}),
],
exports: [KnexService, connectionFactory],
})
export class KnexModule {}
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
I am getting this error from the
/.constants
. Why is this throwing an error for a constant?Hi Mike,
Can you provide some more context for this error? Do you have a repository that you can share?
Best,
John
Hi. For the future readers;
Error complains about NestKnexService can not resolve injected dependency. In this case the dependancy is NEST_KNEX_OPTIONS which is a custom provider. To make the dependency injection work, the provider needs to be registered in the knex module. NEST_KNEX_OPTIONS provider is not included in this article. It is included in github link author provided.