fvilers / nestjs-algolia Goto Github PK
View Code? Open in Web Editor NEWThe algolia NestJS module based on the official algolia package
License: MIT License
The algolia NestJS module based on the official algolia package
License: MIT License
Error message
2019-09-24T18:02:00.115Z [ERROR] [ExceptionHandler] Nest can't resolve dependencies of the AlgoliaService (?). Please make sure that the argument at index [0] is available in the SearchIndexModule context.Error: Nest can't resolve dependencies of the AlgoliaService (?). Please make sure that the argument at index [0] is available in the SearchIndexModule context.
at Injector.lookupComponentInExports (/Users/paulsalmon/workspace/plato/plato-monorepo-research/node_modules/@nestjs/core/injector/injector.js:183:19)
at process._tickCallback (internal/process/next_tick.js:68:7)
at Function.Module.runMain (internal/modules/cjs/loader.js:757:11)
at Object.<anonymous> (/Users/paulsalmon/workspace/plato/plato-monorepo-research/node_modules/ts-node/src/bin.ts:158:12)
at Module._compile (internal/modules/cjs/loader.js:701:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:712:10)
at Module.load (internal/modules/cjs/loader.js:600:32)
at tryModuleLoad (internal/modules/cjs/loader.js:539:12)
at Function.Module._load (internal/modules/cjs/loader.js:531:3)
at Function.Module.runMain (internal/modules/cjs/loader.js:754:12)
error Command failed with exit code 1.
// search-index.module.ts
import { Module } from '@nestjs/common';
import { AlgoliaModule, AlgoliaService } from 'nestjs-algolia';
import { SearchIndexService } from './search-index.service';
@Module({
imports: [
AlgoliaModule.register({
applicationId: 'APPLICATION_ID',
apiKey: 'API_KEY',
}),
],
providers: [AlgoliaService, SearchIndexService],
})
export class SearchIndexModule {}
// search-index.service.ts
import { Injectable } from '@nestjs/common';
import { AlgoliaService } from 'nestjs-algolia';
@Injectable()
export class SearchIndexService {
constructor(private readonly algoliaService: AlgoliaService) {}
}
Versions:
@nestjs/common - 6.7.1
@nestjs/core - 6.7.1
nestjs-algolia - 1.1.0
Hello! Thank you for the project. So I am having this error that I would guess is related to the last update of Nest. Any idea?
HI I have an issue with Algolia:
import { AlgoliaModule, AlgoliaService } from 'nestjs-algolia';
import { Module } from '@nestjs/common';
import { algoliaAppId, algoliaWriteApiKey } from '../../utils/utils';
import { Algolia } from '@business/algolia/algolia.service';
@Module({
imports: [
AlgoliaModule.register({
applicationId: algoliaAppId,
apiKey: algoliaWriteApiKey,
}),
AlgoliaService,
],
providers: [Algolia, AlgoliaService],
exports: [Algolia, AlgoliaService],
})
export class AlgoModule {}
import { AlgoliaService } from 'nestjs-algolia';
import { Injectable } from '@nestjs/common';
@Injectable()
export class Algolia {
constructor(private readonly algoliaService: AlgoliaService) {}
addRecordToIndex(indexName: string, record: any): Promise<any> {
const index = this.algoliaService.initIndex(indexName);
return index.addObject(record);
}
}
Error: Nest can't resolve dependencies of the AlgoliaService (?). Please make sure that the argument ALGOLIA_CLIENT at index [0] is available in the AlgoliaService context.
Potential solutions:
- If ALGOLIA_CLIENT is a provider, is it part of the current AlgoliaService?
- If ALGOLIA_CLIENT is exported from a separate @Module, is that module imported within AlgoliaService?
@Module({
imports: [ /* the Module containing ALGOLIA_CLIENT */ ]
})
I am running nest v4, and using the v4 of this library, but am unsure if this uses the v3 or v4 version of algolia's node client.
I just tried using the findObject
method and it is saying that the method is not available on the index
object. Other methods are working fine for me.
Hi
Do you have any plan to add forRoot
module registration method?
By register
we need to re-register individually for each module.
Using force install it seems to work just fine but would be nice if that could be updated.
Thanks
Olaf
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.