GithubHelp home page GithubHelp logo

underfisk / nestjs-pusher Goto Github PK

View Code? Open in Web Editor NEW
13.0 13.0 9.0 34.92 MB

Pusher module for nestjs with support for event chunking and decorators

Home Page: https://underfisk.github.io/nestjs-pusher/

JavaScript 2.57% TypeScript 97.43%
nestjs nodejs pusher realtime typescript

nestjs-pusher's Introduction

Anurag's github stats

nestjs-pusher's People

Contributors

abebelagua avatar dependabot[bot] avatar gulsharan avatar underfisk avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

nestjs-pusher's Issues

TypeError: _pusher is not a constructor

TypeError: _pusher is not a constructor
    at new PusherService (/usr/src/app/node_modules/.pnpm/[email protected]_@[email protected]_@[email protected][email protected]/node_modules/nestjs-pusher/dist/pusher.service.js:129:23)
    at Object.<anonymous> (/usr/src/app/node_modules/.pnpm/[email protected]_@[email protected]_@[email protected][email protected]/node_modules/nestjs-pusher/dist/pusher-testing-util.js:14:15)

    at Module._compile (node:internal/modules/cjs/loader:1257:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1311:10)
    at Module.load (node:internal/modules/cjs/loader:1115:32)
    at Function.Module._load (node:internal/modules/cjs/loader:962:12)
    at Module.require (node:internal/modules/cjs/loader:1139:19)
    at require (node:internal/modules/helpers:121:18)
    at Object.<anonymous> (/usr/src/app/node_modules/.pnpm/[email protected]_@[email protected]_@[email protected][email protected]/node_modules/nestjs-pusher/dist/index.js:8:14)
    at Module._compile (node:internal/modules/cjs/loader:1257:14)
```

pusher_1.default is not a constructor

@underfisk Thanks for creating this amazing library! However, I noticed the following error as I tried using it in one of my projects. On some digging, I found that the issue gets fixed if you use import * as Pusher instead of import Pusher in this line. Please let me know if you need a PR for this change.

node_modules/nestjs-pusher/dist/pusher.service.js:21
        this.pusher = new pusher_1.default(options);
^
TypeError: pusher_1.default is not a constructor
    at new PusherService (/Users/gul/Dev/vt_ed/dist/apps/api/webpack:/vt/node_modules/nestjs-pusher/dist/pusher.service.js:21:1)

Error when installing with NestJS v8 project

I tried to import this package in my NestJS v8 project, but it failed to install as nestjs-pusher requires NestJS v7 as a peer dependency.

This is my exact error

npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: [email protected]
npm ERR! Found: @nestjs/[email protected]
npm ERR! node_modules/@nestjs/common
npm ERR!   @nestjs/common@"^8.0.0" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer @nestjs/common@"^7.5.1" from [email protected]
npm ERR! node_modules/nestjs-pusher
npm ERR!   nestjs-pusher@"^0.0.10" from the root project

I also noticed you use NestJS v8 as a dev dependency. What's the reason for the mismatch?

PusherInterceptor - Cannot read properties of undefined (reading 'name')

Bug Details

PusherInterceptor throws an error on the following line as it is expecting eventName to be an object, but it is a string.

this.pusherService.trigger(
  channelName,
  eventName.event.name,
  data,
  socketId,
)

Possible Fix #1

Update the interceptor to expect eventName to be a string and not an object.

Possible Fix #2

Update PusherEvent decorator to set the metadata value as an object as shown below:

const eventName = { event: { name } };
Reflect.defineMetadata(PUSHER_EVENT, eventName, descriptor.value);

Disclaimer: I don't know the side-effects of either fix.

Sample code

Is there any sample code to know how can we use and sent event to Pusher?

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.