8000 Problem using Query with latest feathersjs and feathers-swift-socketio · Issue #25 · feathersjs-ecosystem/feathers-swift · GitHub
[go: up one dir, main page]

Skip to content
This repository was archived by the owner on Jun 24, 2025. It is now read-only.
This repository was archived by the owner on Jun 24, 2025. It is now read-only.

Problem using Query with latest feathersjs and feathers-swift-socketio #25

@pdupris

Description

@pdupris

I'm using feathers-swift and feathers-swift-socketio to connect a iOS app to a feathersjs + mongoose service.

I have been able to successfully connect my iOS app to the feathers server, and I am also able to receive real-time events fine.

This all works fine:

         manager = SocketManager(socketURL: URL(string: "http://localhost:3030")!, config: [.log(true), .compress])
        socketProvider = SocketProvider(manager: manager, timeout: 5)
        feathersSocket = Feathers(provider: socketProvider)
        clipService = feathersSocket.service(path: "clip")

        // Works fine!
        clipService.on(event: .created)
            .observeValues { entity in
                print(entity)
        }

However - I am running into an issue when attempting to query a service.

This simple query...

        let query = Query()
            .limit(25)
        clipService.request(.find(query: query)).on(value: { response in
            print(response)
        }).start()

causes my server to crash:

/Users/username/Developer/scanner-backend/node_modules/@feathersjs/commons/lib/utils.js:3
  return name.replace(/^(\/*)|(\/*)$/g, '');
              ^

TypeError: name.replace is not a function
    at stripSlashes (/Users/username/Developer/scanner-backend/node_modules/@feathersjs/commons/lib/utils.js:3:15)
    at Function.lookup (/Users/username/Developer/scanner-backend/node_modules/@feathersjs/transport-commons/lib/routing.js:16:36)
    at _run (/Users/username/Developer/scanner-backend/node_modules/@feathersjs/transport-commons/lib/socket/utils.js:70:24)
    at exports.runMethod (/Users/username/Developer/scanner-backend/node_modules/@feathersjs/transport-commons/lib/socket/utils.js:97:3)
    at Socket.socket.on.args (/Users/username/Developer/scanner-backend/node_modules/@feathersjs/transport-commons/lib/socket/index.js:27:11)
    at emitTwo (events.js:126:13)
    at Socket.emit (events.js:214:7)
    at /Users/username/Developer/scanner-backend/node_modules/socket.io/lib/socket.js:513:12
    at _combinedTickCallback (internal/process/next_tick.js:131:7)
    at process._tickCallback (internal/process/next_tick.js:180:9)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! scanner-backend@0.0.0 start: `node src/`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the scanner-backend@0.0.0 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/username/.npm/_logs/2018-03-12T06_00_37_104Z-debug.log

I did some debugging server side, and found that in the file feathersjs/transport-commons/lib/routing.js:16 the problem was that, "path" was being passed in as an array rather than a string. This causes stripSlashes() to crash.

query-swift-crash

I'm not sure why this is happening or how to fix it properly. As a temporary work around I check for an array there, and pull the first element out. This work around prevents the crash, but all the query parameters are discarded.

Please help!

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    0