Skip to content
This repository has been archived by the owner on Jun 4, 2023. It is now read-only.

Property 'GET' of ... is not a function #34

Closed
LinusU opened this issue Aug 30, 2014 · 4 comments
Closed

Property 'GET' of ... is not a function #34

LinusU opened this issue Aug 30, 2014 · 4 comments

Comments

@LinusU
Copy link

LinusU commented Aug 30, 2014

I saw this once long before and didn't think more of it, but now I have finally found out why it happens.

/usr/local/lib/node_modules/airsonos/node_modules/nodetunes/lib/rtsp.js:47
    this.methodMapping[req.method](req, res);
                                  ^
TypeError: Property 'GET' of object #<Object> is not a function
    at RtspServer.<anonymous> (/usr/local/lib/node_modules/airsonos/node_modules/nodetunes/lib/rtsp.js:47:35)
    at emit (events.js:98:17)
    at null.<anonymous> (/usr/local/lib/node_modules/airsonos/node_modules/nodetunes/node_modules/httplike/lib/server/parser.js:78:16)
    at Socket.emit (events.js:95:17)
    at Socket.<anonymous> (_stream_readable.js:764:14)
    at Socket.emit (events.js:92:17)
    at emitReadable_ (_stream_readable.js:426:10)
    at emitReadable (_stream_readable.js:422:5)
    at readableAddChunk (_stream_readable.js:165:9)
    at Socket.Readable.push (_stream_readable.js:127:10)

Turns out that something is using port 5000, which I'm also using when developing a website in node.js. What happens is that my server fails to listen to port 5000, obviously, and when I visit http://localhost:5000/ in my browser, it makes the request that kills the server.

A simple check to end the connection instead of crashing the entire program would be nice :)

@stephen
Copy link
Owner

stephen commented Sep 15, 2014

Hm, I don't believe this should be the reason for this error popping up.

Nodetunes should compensate for ports being used, and attempts to find something between 5000 and 5050 that's unused. (see: https://github.com/stephen/nodetunes/blob/master/lib/server.js#L50-L53)

@LinusU
Copy link
Author

LinusU commented Sep 15, 2014

Just to clarify, my server wasn't listening at all. I thought that it was listening on port 5000 and thus directed my web browser to http://localhost:5000. That made it send GET / HTTP/1.1\r\n to the airsonos process, which then failed when trying to execute the function methodMapping['GET'].

@jorgenkg
Copy link

First of all: @stephen, I love airsonos!

This error also occurs on my Mac whenever I try to AirPlay the sound output from the computer to airsonos. From my understanding, it seems that nodetunes might be the problem.

I'm not sure whether you've got access to a Mac, but I've describe how to reproduce the error below:

  1. Option-click the speaker icon in the top right
  2. Select the airsonos instance
  3. The appended errorlog is then printed:
Searching for Sonos devices on network...
Setting up AirSonos for [PLAY:3]

/usr/local/lib/node_modules/airsonos/node_modules/nodetunes/lib/rtsp.js:47
    this.methodMapping[req.method](req, res);
                                  ^
TypeError: Property '' of object #<Object> is not a function
    at RtspServer.<anonymous> (/usr/local/lib/node_modules/airsonos/node_modules/nodetunes/lib/rtsp.js:47:35)
    at EventEmitter.emit (events.js:98:17)
    at null.<anonymous> (/usr/local/lib/node_modules/airsonos/node_modules/nodetunes/node_modules/httplike/lib/server/parser.js:78:16)
    at Socket.EventEmitter.emit (events.js:95:17)
    at Socket.<anonymous> (_stream_readable.js:745:14)
    at Socket.EventEmitter.emit (events.js:92:17)
    at emitReadable_ (_stream_readable.js:407:10)
    at emitReadable (_stream_readable.js:403:5)
    at readableAddChunk (_stream_readable.js:165:9)
    at Socket.Readable.push (_stream_readable.js:127:10)

@stephen
Copy link
Owner

stephen commented Sep 30, 2014

I believe this should be fixed in 0.0.17. (nodetunes now checks for invalid methods)

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

3 participants