Giter Site home page Giter Site logo

fvilers / nestjs-algolia Goto Github PK

View Code? Open in Web Editor NEW
16.0 4.0 8.0 353 KB

The algolia NestJS module based on the official algolia package

License: MIT License

JavaScript 1.86% TypeScript 98.14%
nestjs nest nodejs typescript algolia algolia-search

nestjs-algolia's Issues

Nest can't resolve dependencies of the AlgoliaService (?). Please make sure that the argument at index [0] is available in the context.

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?

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.

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 */ ]
  })

Are all algolia node methods supported?

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.

supporting root registration

Hi
Do you have any plan to add forRootmodule registration method?
By register we need to re-register individually for each module.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.