Skip to content
This repository has been archived by the owner on Nov 2, 2022. It is now read-only.

Error: Timeout of 5000ms exceeded calling create on users #8

Closed
netwrkx opened this issue Feb 5, 2018 · 6 comments
Closed

Error: Timeout of 5000ms exceeded calling create on users #8

netwrkx opened this issue Feb 5, 2018 · 6 comments

Comments

@netwrkx
Copy link

netwrkx commented Feb 5, 2018

firstly, i googled and found this error only occur if the service isnt available but in my case, the service exists and i've tested it using postman(localhost:5050/users) and it worked
but everytime i use it with my ionic app i get Error: Timeout of 5000ms exceeded calling create on users. this is a snippet of my code.
Any idea why?

User Service
 const Model = createModel(app)
  const paginate = app.get('paginate')

  const options = {
    name: 'users',
    Model,
    paginate
  }

  // Initialize our service with any options it requires
  app.use('/users', createService(options))

  // Get our initialized service so that we can register hooks and filters
  const service = app.service('users')

  service.hooks(hooks)

  if (service.filter) {
    service.filter(filters)
  }
ionic component
               let email = form.value.email;
		let password = form.value.password;
		this.feathers.service('users')
		  .create({email, password})
		  .then((res) => {
		    loading.dismiss();
			console.log('User created.', res)
			this.app.getRootNav().setRoot(TabsPage);
		  })
		  .catch(err => {
			  loading.dismiss();
			  let errorMessage = "An error has occurred, try again later."
			  this.toastCtrl.create({message: errorMessage, duration: 4500})
              .present();
			  console.log('Could not create user!', err)
		  });

ionic provider
  private _feathers: any;
  private _socket: any;
  
  constructor() {
    this._socket = io('http://localhost:5050');       // init socket.io

    this._feathers = feathers();                      // init Feathers
    this._feathers.configure(feathersRx({             // add feathers-reactive plugin
      idField: '_id'
    }));
    this._feathers.configure(socketio(this._socket)); // add socket.io plugin
    this._feathers.configure(authentication({         // add authentication plugin
      storage: window.localStorage
    }));


  }
  
  // expose services
  public service(name: string) {
    return this._feathers.service(name);
  }
@daffl
Copy link
Member

daffl commented Feb 5, 2018

Related issue is feathersjs-ecosystem/socketio-client#9 and so far it looks like Angulars latest Zone.js simply does not seem to work properly with Socket.io.

@j2L4e
Copy link
Collaborator

j2L4e commented Feb 5, 2018

and i've tested it using postman(localhost:5050/users) and it worked
but everytime i use it with my ionic app i get Error: Timeout of 5000ms exceeded calling create on users.

postman uses http, while your error originates from websockets.

I updated the repo to buzzard, please recheck if you're having a configuration issue going on.

@daffl
Copy link
Member

daffl commented Feb 6, 2018

Probably similar to feathersjs-ecosystem/socketio-client#9 which could be solved by reinstalling everything.

@daffl daffl closed this as completed Feb 14, 2018
@abalad
Copy link

abalad commented Mar 27, 2018

I am also trying this problem when I try to send a POST to a service, but this only occurs when there are 2 or more connected with the same credentials.

And by acquaintance I'm also working with Angular + FeatherJS

@daffl
Copy link
Member

daffl commented Mar 28, 2018

Can you maybe create a new issue with a reproducible example repository?

@3zbumban
Copy link

3zbumban commented Nov 18, 2021

I had the same issue using these package's on the client side with vue.js (vue@^3.2.16 and vite@2.6.4)

  • @feathersjs/feathers@^4.5.11
  • @feathersjs/socketio-client@^4.5.11
  • socket.io-client@^2.3.1
  • @feathersjs/authentication-client@^4.5.11

My issue was resolved after changing

import io from "socket.io-client";

to

import io from "socket.io-client/dist/socket.io";

issues i came across: feathersjs-ecosystem/socketio-client#14

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants