My nestjs app starts to blow up pointing to AXIOS_INSTANCE_TOKEN
error and request for the module containing AXIOS_INSTANCE_TOKEN
to be imported... the thing is the only module using Axios is HttpModule and it was imported from the start. this is what I have:
the error:
] [Nest] 94322 - 02/04/2021, 12:16:31 PM [Genysis Gateway] Start Gateway
[0] [Nest] 94322 - 02/04/2021, 12:16:32 PM [NestFactory] Starting Nest application...
[0] [Nest] 94322 - 02/04/2021, 12:16:32 PM [InstanceLoader] RavenModule dependencies initialized
[0] [Nest] 94322 - 02/04/2021, 12:16:32 PM [InstanceLoader] MsConnectorModule dependencies initialized
[0] [Nest] 94322 - 02/04/2021, 12:16:32 PM [InstanceLoader] ChatModule dependencies initialized
[0] [Nest] 94322 - 02/04/2021, 12:16:32 PM [InstanceLoader] HttpModule dependencies initialized
[0] [Nest] 94322 - 02/04/2021, 12:16:32 PM [InstanceLoader] HttpModule dependencies initialized
[0] [Nest] 94322 - 02/04/2021, 12:16:32 PM [InstanceLoader] HttpModule dependencies initialized
[0] [Nest] 94322 - 02/04/2021, 12:16:32 PM [InstanceLoader] ConfigHostModule dependencies initialized
[0] [Nest] 94322 - 02/04/2021, 12:16:32 PM [ExceptionHandler] Nest can't resolve dependencies of the HttpService (?). Please make sure that the argument AXIOS_INSTANCE_TOKEN at index [0] is available in the AppModule context.
[0]
[0] Potential solutions:
[0] - If AXIOS_INSTANCE_TOKEN is a provider, is it part of the current AppModule?
[0] - If AXIOS_INSTANCE_TOKEN is exported from a separate @Module, is that module imported within AppModule?
[0] @Module({
[0] imports: [ /* the Module containing AXIOS_INSTANCE_TOKEN */ ]
[0] })
THIS IS THE APP MODULE:
......
@Module({
imports: [
RavenModule,
ConfigModule.forRoot({
isGlobal: true,
load: [configuration],
}),
HttpModule.register({
timeout: 5000,
maxRedirects: 5,
}),
AuthModule,
UserModule,
.......
I noticed that the three references to HttpModule initialized ok. Also, I have a check and the two other modules with HttpModules have correctly imported HttpModule in the Module and the injected the HttpService in the Service.
I also noticed that the build died while building ConfigModule...not sure what that means?.... I have also deleted node_modules and run npm I twice and upgrade my nestjs/common from 7.5.1 to 7.6.11 all to no avail.
I would really appreciate any insights on this! Thanks in advance.
question from:
https://stackoverflow.com/questions/66051038/axios-instance-token-error-in-nestjs-startup 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…