Git Product home page Git Product logo

feathers-chat's Introduction

Feathers Chat

Feathers logo

A FeathersJS Chat Application

NPM version

Replit

About

This repository includes the server application from the official Feathers chat guide as well as chat frontend examples for different frameworks.

API server

TypeScript

The TypeScript version of the chat API server can be found in the feathers-chat-ts. To start it install the dependencies like this:

cd feathers-chat-ts
npm install

Then compile the source code and run the database migration which will initialize an SQLite database in the feathers-chat.sqlite file.

npm run compile
npm run migrate

It can now be started with:

npm start

Or in development mode with

npm run dev

Now go to http://localhost:3030 to start chatting 🕊️

Frontend

Plain JavaScript

A plain JavaScript frontend can be found in the public folder which is hosted statically by the api server examples.

React

TBD

VueJS

TBD

feathers-chat's People

Contributors

ais-one avatar appurist avatar benjick avatar bertho-zero avatar chrjean avatar corymsmith avatar daffl avatar davidalee avatar dependabot-preview[bot] avatar dependabot[bot] avatar dv336699 avatar eddyystop avatar ekryski avatar emp3ror avatar fossprime avatar github-actions[bot] avatar greenkeeper[bot] avatar greenkeeperio-bot avatar greyarch avatar hanzlamateen avatar ismail-codinglab avatar j2l4e avatar j3soon avatar kulakowka avatar marshallswain avatar morenoh149 avatar nrullo avatar rabalyn avatar ttimasdf avatar vacmar01 avatar

Stargazers

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

Watchers

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

feathers-chat's Issues

There was an error: Authentication timed out

A fresh clone and npm install contains an error when attempting to authenticate:

Steps to reproduce:

  1. clone a fresh copy of the repo
  2. cd feathers-chat && yarn
  3. yarn start
  4. Visit http://localhost:3030/jquery or http://localhost:3030/vanilla
  5. Create a user account
  6. Attempt to sign in with newly created credntials

Error is (server console)

info: after: users - Method: find
error: Unhandled Rejection at: Promise  Promise {
  <rejected> TypeError: done is not a function
    at /home/cameron/sde/cam/feathers-chat/node_modules/feathers-authentication-local/lib/verifier.js:136:38 } TypeError: done is not a function
    at /home/cameron/sde/cam/feathers-chat/node_modules/feathers-authentication-local/lib/verifier.js:136:38

need to update to new common

Calling populate(target, options) is now DEPRECATED and will be removed in the future. Refer to docs.feathersjs.com for more information. (legacyPopulate)

app.js:84 Uncaught TypeError: Cannot read property 'insertAdjacentHTML' of null

The vanilla chat demo generates this error in the browser console:

app.js:84 Uncaught TypeError: Cannot read property 'insertAdjacentHTML' of null
    at r.addUser (app.js:84)
    at r.emit (index.js:133)
    at r.onevent (socket.js:270)
    at r.onpacket (socket.js:228)
    at r.<anonymous> (index.js:21)
    at r.emit (index.js:133)
    at r.ondecoded (manager.js:345)
    at s.<anonymous> (index.js:21)
    at s.r.emit (index.js:133)
    at s.add (index.js:241)

it still seems to work, however the error is not helpful while trying to dig into feathers-client.

oauth github sign in

works in my windows 7 chrome

does not work on windows 10: Chrome, Edge, and Firefox

Firfox message:
Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://github.githubassets.com/assets/frameworks-2fd1891c9e6292401a1a3de8bc3f747f.css. (Reason: CORS request did not succeed).[Learn More]
Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://github.githubassets.com/assets/github-211e7a5168e3492fd5f3d4312f92593c.css. (Reason: CORS request did not succeed).[Learn More]

Private Chat Example?

Hello,

First of all, this is a great framework, and i like this example. But i'd be nice if a private chat is implemented with it (if possible). tnx.

Example 'app.publish is not a function'

When I try to follow the example from your website I get the following error:

app.publish(data => app.channel('everybody'));
^
TypeError: app.publish is not a function
at Object. (/home/julian/Desktop/PR06/server/app.js:46:5)
at Module._compile (internal/modules/cjs/loader.js:1147:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1167:10)
at Module.load (internal/modules/cjs/loader.js:996:32)
at Function.Module._load (internal/modules/cjs/loader.js:896:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)
at internal/main/run_main_module.js:17:47

I am running on node v13.10.1

And have copied the exact code from the website:

const feathers = require('@feathersjs/feathers');
const express = require('@feathersjs/express');
const socketio = require('@feathersjs/socketio');

// A messages service that allows to create new
// and return all existing messages
class MessageService {
  constructor() {
    this.messages = [];
  }

  async find () {
    // Just return all our messages
    return this.messages;
  }

  async create (data) {
    // The new message is the data merged with a unique identifier
    // using the messages length since it changes whenever we add one
    const message = {
      id: this.messages.length,
      text: data.text
    }

    // Add new message to the list
    this.messages.push(message);

    return message;
  }
}

// Creates an ExpressJS compatible Feathers application
const app = express(feathers());

// Parse HTTP JSON bodies
app.use(express.json());
// Parse URL-encoded params
app.use(express.urlencoded({ extended: true }));
// Host static files from the current folder
app.use(express.static(__dirname));
// Add REST API support
app.configure(express.rest());
// Configure Socket.io real-time APIs
app.configure(socketio());
// Register an in-memory messages service
app.use('/messages', new MessageService());
// Register a nicer error handler than the default Express one
app.use(express.errorHandler());

// Add any new real-time connection to the `everybody` channel
app.on('connection', connection =>
  app.channel('everybody').join(connection)
);
// Publish all events to the `everybody` channel
app.publish(data => app.channel('everybody'));

// Start the server
app.listen(3030).on('listening', () =>
  console.log('Feathers server listening on localhost:3030')
);

// For good measure let's create a message
// So our API doesn't look so empty
app.service('messages').create({
  text: 'Hello world from the server'
});


XSS Vulnerability in user email

Hi, I've been following the tutorial. However, I noticed that there are no email and password validations in this example. So, if we fill in the email with:

<img src="https://duckduckgo.com/assets/logo_homepage.normal.v107.svg" onload="alert('XSS Vulnerability?')">

and then create a user, all users will execute the script and pop out the alert message.

I'm wondering if the validation part was omitted on purpose for simplicity? If not, maybe I can try to implement this. (add a hook before user creation that throws an error when receiving emails in the wrong format?)

Authentication problem with react app

Hello,
I've been working through the "first app" tutorial, and I've run into a problem where, after logging in, the login action is successfull (it returns a token, creates the cookie and saves the token to localStorage), but immediately after, the request to get messages inside the componentDidMount() method of the ChatApp component. I changed it to:

componentDidMount() {
    const userService = app.service('users');
    const messageService = app.service('messages');

    // Find all users initially
    userService.find().then(page => this.setState({ users: page.data }));
    // Listen to new users so we can show them in real-time
    userService.on('created', user => this.setState({ users: this.state.users.concat(user) }));

    //fetch the users
    messageService.find({
      query: {
        $sort: { createdAt: -1 },
        $limit: this.props.limit || 10
      }
    })
      .then((page) => {
        return this.setState({ messages: page.data.reverse() })
      })
      .catch(err => console.log(err))

    //listen for new messages
    messageService.on('created', (message) => {
      return this.setState({
        messages: this.state.messages.concat(message)
      });
    });
  }

and I get the error in the console:

Object {name: "NotAuthenticated", message: "You are not authenticated.", code: 401, className: "not-authenticated", errors: Object}

As I mentioned, the JWT is stored in the cookie and localStorage

Thanks for your time, and for a very promising framework.

An in-range update of @feathersjs/authentication is breaking the build 🚨

The dependency @feathersjs/authentication was updated from 2.1.10 to 2.1.11.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

@feathersjs/authentication is a direct dependency of this project, and it is very likely causing it to break. If other packages depend on yours, this update is probably also breaking those in turn.

Status Details
  • continuous-integration/travis-ci/push: The Travis CI build could not complete due to an error (Details).

Commits

The new version differs by 7 commits.

  • cdbfba9 Publish
  • 1967832 Use top level shx command
  • 401e6a4 Update all lockfiles
  • a20042c chore: Update Codeclimate settings (#1014)
  • aa4276f packages: Adding @feathersjs/client package (#1013)
  • af97818 fix: Normalize params to object even when it is falsy (#1012)
  • 1b866ea Fix Lerna commit message

See the full diff

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

connect to mongodb

Hello,
First of all, this is a great framework, and i like this example. But How can I connect to the Mongo db instead of nedb on this example.thanks

Signup.js middleware - only authenticated users

If you want to have only "admin users" that can create accounts, the middleware opens a security breach as it allows non logged in people to create users.

if in the users service you protect the create method as such:

  create: [
    auth.verifyToken(),
    auth.populateUser(),
    auth.hashPassword(),
    auth.restrictToAuthenticated(),
    auth.restrictToRoles({
      roles: ['admin'],
      fieldName: 'permissions'
    })
  ],

The API endpoint POST /users is effectively disabled for non 'admin' users
But the middleware does allow the creation of new users:

    app.service('users').create({
      email: body.email,
      password: body.password,
      permissions: 'registered'
    })

The solution could be to create a "signup service" with one method "create"

  setup(app) {
    this.app = app;
  }

  create(data, params) {
      this.app.service('users').create({
        email: data.email,
        password: data.password,
        permissions: 'registered'
    })
    return Promise.resolve({status:200, data: data, message: 'User created (registered)'});
  }

Then do not forget the restriction in the create: [] of the before hook.

Error need to be managed.

Upgrading Helmet to the next major version

I'm the maintainer of Helmet. I plan to release the next major version this Sunday, 2020-08-22.

Is there anything I can do to help get this project upgraded to helmet@4?

If you'd like to try out the release candidate now, you can install it with npm install helmet@next. If you'd rather discuss things outside of this issue, feel free to reach out to me another way.

Hope I can be helpful!

Help

[email protected] start /Users/hamptonmoore/Downloads/feathers-chat-master
node src/

module.js:327
throw err;
^

Error: Cannot find module 'ee-first'
at Function.Module._resolveFilename (module.js:325:15)
at Function.Module._load (module.js:276:25)
at Module.require (module.js:353:17)
at require (internal/module.js:12:17)
at Object. (/Users/hamptonmoore/Downloads/feathers-chat-master/node_modules/feathers/node_modules/express/node_modules/on-finished/index.js:23:13)
at Module._compile (module.js:409:26)
at Object.Module._extensions..js (module.js:416:10)
at Module.load (module.js:343:32)
at Function.Module._load (module.js:300:12)
at Module.require (module.js:353:17)

npm ERR! Darwin 15.2.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "start"
npm ERR! node v4.3.1
npm ERR! npm v2.14.12
npm ERR! code ELIFECYCLE
npm ERR! [email protected] start: node src/
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] start script 'node src/'.
npm ERR! This is most likely a problem with the feathers-chat package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node src/
npm ERR! You can get their info via:
npm ERR! npm owner ls feathers-chat
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR! /Users/MYDIR/Downloads/feathers-chat-master/npm-debug.log

readme is dated

Readme is still showing yo generator instead of the new feathers-cli generator

Logo/Icon Proposal

Greetings, Im a graphics designer here on Github and I would like to ask for your permission to design for your logo/icon that you maybe used for your future plans in your project. I want to help open source projects by designing logos or banners for there project. Thank you for your time reading this

Best regards
-jbeguna04

Async Error Hook Gravatar

Hello,

when i modify my gravatar.js code to the Tutorial Code i get a fail when i start the server.

return async context => { ^^^^^^^

When i remove the async in the gravatar.js the server starts normally..

Someone have a clue?

"TypeError: Cannot read property '_id' of undefined" and other errors

$ git clone https://github.com/feathersjs/feathers-chat.git

Clonage dans 'feathers-chat'...
remote: Counting objects: 901, done.
remote: Compressing objects: 100% (16/16), done.
remote: Total 901 (delta 5), reused 16 (delta 3), pack-reused 881
Réception d'objets: 100% (901/901), 909.87 KiB | 407.00 KiB/s, fait.
Résolution des deltas: 100% (431/431), fait.

$ cd feathers-chat
$ npm install

> [email protected] install […]\feathers-chat\node_modules\uws
> node-gyp rebuild > build_log.txt 2>&1 || exit 0

npm WARN [email protected] No repository field.
npm WARN [email protected] No license field.

added 474 packages in 46.802s

$ npm start

> [email protected] start […]\feathers-chat
> node src/

info: Feathers application started on http://localhost:3030

At 1st launch only: (???)

error: NotFound: Page not found
at new NotFound ([…]\feathers-chat\node_modules@feathersjs\errors\lib\index.js:109:17)
at […]\feathers-chat\node_modules@feathersjs\errors\lib\not-found-handler.js:5:10
at Layer.handle [as handle_request] ([…]\feathers-chat\node_modules\express\lib\router\layer.js:95:5)
at trim_prefix ([…]\feathers-chat\node_modules\express\lib\router\index.js:317:13)
at […]\feathers-chat\node_modules\express\lib\router\index.js:284:7
at Function.process_params ([…]\feathers-chat\node_modules\express\lib\router\index.js:335:12)
at next ([…]\feathers-chat\node_modules\express\lib\router\index.js:275:10)
at exposeHeaders ([…]\feathers-chat\node_modules@feathersjs\authentication\lib\express\expose-headers.js:10:5)
at Layer.handle [as handle_request] ([…]\feathers-chat\node_modules\express\lib\router\layer.js:95:5)
at trim_prefix ([…]\feathers-chat\node_modules\express\lib\router\index.js:317:13)

When I send a message (vanilla or jquery) :

  1. At first the message is not stored :

error: TypeError: Cannot read property '_id' of undefined
at Object.<anonymous> ([…]\feathers-chat\src\hooks\process-message.js:24:20)
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:188:7)

  1. After reloading the page in the browser (I guess) the message is stored but not displayed :

error: Error: An id must be provided to the 'get' method
at validateArguments ([…]\feathers-chat\node_modules@feathersjs\commons\lib\arguments.js:47:15)
at Object.mixin.(anonymous function) ([…]\feathers-chat\node_modules@feathersjs\feathers\lib\hooks.js:41:9)
at Object.get ([…]\feathers-chat\node_modules\uberproto\lib\proto.js:30:17)
at Promise.all.messages.map ([…]\feathers-chat\src\hooks\populate-user.js:18:47)
at Array.map (<anonymous>)
at Object.<anonymous> ([…]\feathers-chat\src\hooks\populate-user.js:15:32)
at <anonymous>

I can switch back to the 1st behaviour if I delete the user.db files.
At a point (?) the user list is emptied ("0 users").

node-v8.9.4-win-x64

Thank you in advance for any help

Initial click on "Sign up and log in" fails with No record found for id '1'

feathers-chat fd729a4 Ubuntu 20.10 Node 14.60.0 Chromium 89.0.4389.90 clone then:

npm install
npm start

visit http://localhost:3030/ enter:

  • email: a@a
  • password a

and click "Sign up and log in".

Instead of working, the browser shows a JavaScript error on the console:

{
    "name": "NotFound",
    "message": "No record found for id '1'",
    "code": 404,
    "className": "not-found",
    "errors": {}
}

and you remain on the page without any visible GUI error.

This can be worked around by first clicking "Login" (which gives "There was an error: Invalid login" as expected), but then doing a second attempt at "Sign up and log in" works and redirects you to the chat as expected

Page is blank because scripts are blocked by browser security

Steps to reproduce

  1. clone the repo
  2. npm install
  3. npm start
  4. enter http://localhost:3030/ in the browser

Expected behavior

See something

Actual behavior

The browser page is blank.

The page code is:

<html lang="en">
  <head>
    <meta http-equiv="content-type" content="text/html; charset=utf-8">
    <meta name="viewport"
      content="width=device-width, initial-scale=1.0, maximum-scale=1, user-scalable=0" />
    <title>FeathersJS chat</title>
    <link rel="shortcut icon" href="favicon.ico">
    <link rel="stylesheet" href="base.css">
    <link rel="stylesheet" href="chat.css">
  </head>
  <body>
    <div id="app" class="flex flex-column"></div>
    <script src="//cdnjs.cloudflare.com/ajax/libs/moment.js/2.12.0/moment.js"></script>
    <script src="//unpkg.com/@feathersjs/client@^4.3.0/dist/feathers.js"></script>
    <script src="/socket.io/socket.io.js"></script>
    <script src="client.js"></script>
  </body>
</html>

Console errors (Chromium)

ERROR: Refused to load the script 'https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.12.0/moment.js' because it violates the following Content Security Policy directive: "script-src 'self'". Note that 'script-src-elem' was not explicitly set, so 'script-src' is used as a fallback.

ERROR: localhost/:1 Refused to load the script 'https://unpkg.com/@feathersjs/client@%5E4.3.0/dist/feathers.js' because it violates the following Content Security Policy directive: "script-src 'self'". Note that 'script-src-elem' was not explicitly set, so 'script-src' is used as a fallback.

ERROR client.js:5 Uncaught ReferenceError: feathers is not defined
at client.js:5

Console errors (Firefox)

(sorry, I have firefox configured in Spanish)

Content Security Policy: No se puede procesar la directiva desconocida 'script-src-attr'

Ha fallado la carga del <script> con origen "http://cdnjs.cloudflare.com/ajax/libs/moment.js/2.12.0/moment.js". localhost:3030:13:1

Ha fallado la carga del <script> con origen "http://unpkg.com/@feathersjs/client@%5E4.3.0/dist/feathers.js". localhost:3030:14:1

Content Security Policy: Las opciones para esta página han bloqueado la carga de un recurso en inline (script-src). localhost:3030:1:1

Content Security Policy: Las opciones para esta página han bloqueado la carga de un recurso en http://cdnjs.cloudflare.com/ajax/libs/moment.js/2.12.0/moment.js (script-src).

Content Security Policy: Las opciones para esta página han bloqueado la carga de un recurso en http://unpkg.com/@feathersjs/client@%5E4.3.0/dist/feathers.js (script-src).

ReferenceError: feathers is not defined client.js:5:16

Content Security Policy: Actualizando solicitud insegura 'ws://localhost:3030/socket.io/?EIO=3&transport=websocket&sid=V884JLfBmOGKZaW9AAAE' para usar 'wss'

Firefox no puede establecer una conexión con el servidor en wss://localhost:3030/socket.io/?EIO=3&transport=websocket&sid=V884JLfBmOGKZaW9AAAE. socket.io.js:8:6159

System configuration

Module versions (especially the part that's not working): N/A?

NodeJS version: 12.18.3

Operating System: Debian GNU/Linux

Browser Version: Firefox 68.11.0esr (64-bit); Chromium 83.0.4103.116 (Developer Build) built on Debian bullseye/sid, running on Debian bullseye/sid (64-bit)

React Native Version: ?

Module Loader: ?

(sorry, I'm not very competent in frontend, I guess the problem is easy because I could not find any other issue on it)

Cannot get github auth working

I carefully followed the getting started guide all the way through - stopping at the writing tests section. I'm hung up on getting github auth to work. I've added the oath app to GH and update the authentications section of default.json. Logging into GH is working and I get the permissions grant screen. Preceding past the that, based on the guide, I expected to be logged into the chat app after authenticating to github.

However, I keep getting redirected to the chat login page. The error that occurs immediately after the permission grant is: Cannot read property 'toLowerCase of null

Here's a screenshot of this after the github permissions grant: https://www.evernote.com/l/ADqsa_P7jj1Ly5YVahH5b4LMbDKTgBX3CEU

Here's the error and stack trace I get on all consecutive attempts to login with githib:
https://www.evernote.com/l/ADq81BrDFOxHx4lLuGKQwt88X_VkvzZYr7k

Here are the auth parts from default.json
"authentication": {
"oauth": {
"redirect": "/",
"github": {
"key": "hidden",
"secret": "hidden"
}
},
"entity": "user",
"service": "users",
"secret": "wplCi9j8gbUzXjBCoP3NGJzGUN8=",
"authStrategies": [
"jwt",
"local"
],

Is there something missing from the quick-start? Perhaps another config setting to enable github?

System configuration

Mac
chrome 81.0.4044.92
node 8.12
"dependencies": {
"@feathersjs/authentication": "^4.5.3",
"@feathersjs/authentication-local": "^4.5.3",
"@feathersjs/authentication-oauth": "^4.5.3",
"@feathersjs/configuration": "^4.5.3",
"@feathersjs/errors": "^4.5.3",
"@feathersjs/express": "^4.5.3",
"@feathersjs/feathers": "^4.5.3",
"@feathersjs/socketio": "^4.5.3",
"@feathersjs/transport-commons": "^4.5.3",
"compression": "^1.7.4",
"cors": "^2.8.5",
"feathers-nedb": "^5.1.0",
"helmet": "^3.22.0",
"nedb": "^1.8.0",
"serve-favicon": "^2.5.0",
"winston": "^3.2.1"
},

npm test error and feathers-chat not working

~/D/feathers-chat-master npm test 11:04:17

[email protected] test /Users/forte/Downloads/feathers-chat-master
npm run jshint && npm run mocha

[email protected] jshint /Users/forte/Downloads/feathers-chat-master
jshint src/. test/. --config

[email protected] mocha /Users/forte/Downloads/feathers-chat-master
mocha test/ --recursive

module.js:327
throw err;
^

Error: Cannot find module '../../../../src/services/message/hooks/verify.js'
at Function.Module._resolveFilename (module.js:325:15)
at Function.Module._load (module.js:276:25)
at Module.require (module.js:353:17)
at require (internal/module.js:12:17)
at Object. (/Users/forte/Downloads/feathers-chat-master/test/services/message/hooks/verify.test.js:4:16)
at Module._compile (module.js:409:26)
at Object.Module._extensions..js (module.js:416:10)
at Module.load (module.js:343:32)
at Function.Module._load (module.js:300:12)
at Module.require (module.js:353:17)
at require (internal/module.js:12:17)
at /Users/forte/Downloads/feathers-chat-master/node_modules/mocha/lib/mocha.js:219:27
at Array.forEach (native)
at Mocha.loadFiles (/Users/forte/Downloads/feathers-chat-master/node_modules/mocha/lib/mocha.js:216:14)
at Mocha.run (/Users/forte/Downloads/feathers-chat-master/node_modules/mocha/lib/mocha.js:468:10)
at Object. (/Users/forte/Downloads/feathers-chat-master/node_modules/mocha/bin/_mocha:403:18)
at Module._compile (module.js:409:26)
at Object.Module._extensions..js (module.js:416:10)
at Module.load (module.js:343:32)
at Function.Module._load (module.js:300:12)
at Function.Module.runMain (module.js:441:10)
at startup (node.js:139:18)
at node.js:968:3

npm ERR! Darwin 15.3.0
npm ERR! argv "/Users/forte/.nvm/versions/node/v4.4.0/bin/node" "/Users/forte/.nvm/versions/node/v4.4.0/bin/npm" "run" "mocha"
npm ERR! node v4.4.0
npm ERR! npm v3.8.2
npm ERR! code ELIFECYCLE
npm ERR! [email protected] mocha: mocha test/ --recursive
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] mocha script 'mocha test/ --recursive'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the feathers-chat package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! mocha test/ --recursive
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs feathers-chat
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls feathers-chat
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR! /Users/forte/Downloads/feathers-chat-master/npm-debug.log
npm ERR! Test failed. See above for more details.

And while I run the chat app with "npm start", I can login to the chat-app but 0 users display

npm test on process-message hook is returning an error "Cannot read property 'text' of undefined"

Following the tutorial to reproduce the error:

The error occurs on the "Processing data" section of the tutorial after adding the process-message.js hook and copying the new code for that file from the tutorial.

The npm test error seems to be occurring on line: if(!data.text) {

test error: 5 passing (71ms)
1 failing

  1. 'process-message' hook
    runs the hook:
    TypeError: Cannot read property 'text' of undefined
    at Object. (src/hooks/process-message.js:9:14)
    at promise.then.hookObject (node_modules/@feathersjs/commons/lib/hooks.js:174:73)
    at

Note: If you proceed with the tutorial the same issue will occur with similar hooks ex. gravatar.

env:
node v8.10.0
npm 5.6.0
feathers 3.6.1
redhat el 7.4

Any user can perform any CRUD operation on messages or users

I was experimenting a little to see how much is provided in the out of the box authentication middleware. I noticed that the chat app allows any authenticated user to perform any CRUD operation on any service. I can change another user's password or message text, for example.

let users = await client.service('users').find();
client.service('users').patch('43WhirE0yJr47G4J', {password: '123456'})

I'm concerned that somebody will get bitten by this.

Mark users as online or offline.

Currently we need to hook into the socket to mark as user online when:

  • They connect & authenticate

and offline when:

  • When the socket disconnects
  • When they logout
  • When they haven't been authenticated or done anything for a while (ie. token expires maybe?)

Crashes on npm start

Hi there,

thanks for the great approach on this frameworks. Looking forward to trying it out.

However, I get this on boot (Node 6, mongo 3.4, npm 5.6.0)
´´´bash
npm start

[email protected] start /Users/matthias/Documents/Projekte/Temp/feathers-chat
node src/

/Users/matthias/Documents/Projekte/Temp/feathers-chat/src/hooks/process-message.js:5
return async context => {
^^^^^^^

SyntaxError: Unexpected identifier
at createScript (vm.js:56:10)
at Object.runInThisContext (vm.js:97:10)
at Module._compile (module.js:542:28)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
at Object. (/Users/matthias/Documents/Projekte/Temp/feathers-chat/src/services/messages/messages.hooks.js:3:24)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] start: node src/
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR! /Users/matthias/.npm/_logs/2017-12-14T21_50_45_000Z-debug.log


Any idea? I think your demo is quite up to date?

app.listen(...).on is not a function

app.listen(3030).on("listening", () => { ^ TypeError: app.listen(...).on is not a function at Object.<anonymous> (/home/mars/Projects/feathers-basics/app.js:55:18)

is the tutorial not updated?
did they remove the on function?

custom event issue

i tried working with custom event on two service ,one with nedb (message service)and other without database (ok service), but got success in message service and still struggling to get ok service custon event working ... there is also a glitch in message service when ever i restart the server ideally it should fire custom event everytime but sometime i receive and sometime not..
whole my client code and server code is in this repo
https://github.com/ajayashuba/feathers-chat/tree/abcd

How to update the number of currently connected users?

Hi,
first of all thanks for this great example. I would ask if possible, if someone can tell me how to make possible that if a user disconnects the number of total user can be updated for all the other users already connected.

Thanks

something seems wrong with global hooks

hi,
im copying this projects dir structure for a project of mine and came accross the global hooks in:

exports.myHook = function(options) {

it seems there are not used anywhere, and the export function seems wrong. shouldn't it be module.exports and doesn't it need a next callback, like it is used in the hooks under the services?
have a great day

Socket connection timed out (Chrome 65 Android)

Hello,
I have now used Feathers for several projects and I really like it (keep it up!). But the other day I noticed a weird bug when testing my app on my Android device. So I checked if my other applications would have the same bug. It turned out that all apps which used socket connections were affected. To really make sure that it wasn't my fault I used the official feathers-chat server and the react client... it also had the same issue.

Bug:

Uncaught (in promise) Error: Socket connection timed out at setTimeout (passport.js:120)
The Bug only occurs on the Android Chrome browser when you're already logged in and reload the page but only approx. 20% of the time (but it varies quite heavily).
I tested Firefox, Opera, Edge and Chrome on Desktop and they all work fine. I had an old Chrome Beta version on my phone (59) and there it also worked. Chrome 65, 66 and 67 all don't work. (devices tested on: Oneplus 3T 8.0, LG G6 7.0, Moto X Play 7.1.1)
Another strange thing: The bug disappears on all Chrome versions if you turn on "Data Saver".

Steps to reproduce:

  • Clone this repo + any client
  • Run both
  • Visit with Chrome 65 on your Android device (data saver turned off!)
  • Create an account and log in
  • Reload a couple times until the timeout occurs (it will show "Loading" for 5s and then redirect to login)

Would be glad if you could help me out somehow or just try to reproduce it.
It's probably just a bug (a pretty weird one) with Chrome but its still pretty annoying when you keep in mind that 30% of all visitors are using it.
If you have any questions or something wasn't clear, please don't hesitate to ask :)

Naming conflict with Main

Seems like really poor style to name a component Main, as when you do that you can't include it in a template as main is a keyword. the vue CLI uses Home.vue instead and wraps everything in App.vue to reduce the need to subroute everything.

Invisible text on signup/login fields

I seem to have invisible text on the login.html and signup.html pages in the feathers-chat example from the docs guide. Even the placeholder text is invisible.

I've pulled the latest git and see the same thing. It does it on the signup form and the login form but not on the actual chat input field.

Also, I only seem to have this problem when using Firefox. It's fine under Chrome. My version of Firefox is the latest at the time of filing this (49.0.1).

It might be a problem with white on white text or something like that, but it looks fine in Chrome. It's just Firefox.

How would the front end connect to a remote backend?

I see in this example (app.js) that there is socket connection to the backend but I am not seeing how the front end determines which socket it is connecting to... or the IP address where the server is located. I may have missed something but would like to know.

Test suite has 2 failures

$ npm test
...                                                                                                                                                                                
  8 passing (130ms)                                                                                                                                                               
  2 failing                                                                                                                                                                       

  1) Feathers application tests 404 shows a 404 HTML page:                                                                                                                        

      Uncaught AssertionError: false == true                                                                                                                                      
      + expected - actual                                                                                                                                                         

      -false                                                                                                                                                                      
      +true                                                                                                                                                                       

      at Request.request [as _callback] (test/app.test.js:28:16)                                                                                                                  
      at Request.self.callback (node_modules/request/request.js:186:22)                                                                                                           
      at Request.<anonymous> (node_modules/request/request.js:1060:10)                                                                                                            
      at IncomingMessage.<anonymous> (node_modules/request/request.js:980:12)                                                                                                     
      at endReadableNT (_stream_readable.js:974:12)                                                                                                                               
      at _combinedTickCallback (internal/process/next_tick.js:74:11)                                                                                                              
      at process._tickCallback (internal/process/next_tick.js:98:9)                                                                                                               

  2) message process hook filters data as expected:                                                                                                                               

      AssertionError: { text: 'foo&amp;', sentBy: '1', createdAt: 1477616262773 } deepEqual { text: 'foo&amp;', userId: '1', createdAt: 1477616262773 }                           
      + expected - actual                                                                                                                                                         

       {                                                                                                                                                                          
         "createdAt": 1477616262773                                                                                                                                               
      -  "sentBy": "1"                                                                                                                                                            
         "text": "foo&amp;"                                                                                                                                                       
      +  "userId": "1"                                                                                                                                                            
       }                                                                                                                                                                          

      at Context.it (test/services/message/hooks/process.test.js:29:12)                                                                                                           

I suppose you've changed formats and/or defaults since these were last run. Setting json: false in the options of 1) didn't work, I still got json back in the test context though I do get HTML in the browser. 2) may just require updating the test for the new format.

Thanks for your amazing work on Feathers I am a huge fan!

Chat bombs on older versions of Safari due to ES6

[Error] TypeError: 'undefined' is not a function (evaluating 'Object.assign')
    (anonymous function) (feathers.js, line 4064)
    s (feathers.js, line 1)
    e (feathers.js, line 1)
    (anonymous function) (feathers.js, line 1)
    (anonymous function) (feathers.js, line 1)
[Error] SyntaxError: Unexpected token 'const' (app.js, line 4)

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.