meetecho / simple-whip-server

Simple WHIP Server (based on the Janus WebRTC Server)
GNU General Public License v3.0
93 stars 24 forks source link

Always get 404 from server on /endpoint/{id} #5

Closed cameronelliott closed 2 years ago

cameronelliott commented 2 years ago

Possibly a silly mistake on my part, but if you could look and see if it is obvious why I am always getting 404, it would be appreciated.

Server side:

$ DEBUG=\* node src/server.js
...
WHIP REST API listening on *:7080
WHIP server prototype started!
[ 'Janus OK', 'WHIP REST API OK' ]
  express:router dispatching POST /whip/create +13s
  express:router query  : /whip/create +1ms
  express:router expressInit  : /whip/create +0ms
  express:router serveStatic  : /whip/create +1ms
  express:router corsMiddleware  : /whip/create +0ms
  express:router jsonParser  : /whip/create +0ms
  body-parser:json content-type "application/json" +0ms
  body-parser:json content-encoding "identity" +2ms
  body-parser:json read body +0ms
  body-parser:json parse body +6ms
  body-parser:json parse json +0ms
  express:router textParser  : /whip/create +8ms
  body-parser:text body already parsed +0ms
  express:router textParser  : /whip/create +0ms
  body-parser:text body already parsed +0ms
  express:router trim prefix (/whip) from url /whip/create +0ms
  express:router router /whip : /whip/create +0ms
  express:router dispatching POST /create +0ms
  whip:debug /create: { id: 'xyz', room: 1234 } +0ms
  whip:info [xyz] Created new WHIP endpoint +13s
  janus:vdebug Sending message: { janus: 'keepalive',
  session_id: 4401051734918689,
  transaction: 'prk1XnxsgryFm7Y1',
  apisecret: undefined } +15s
  janus:vdebug Received message: { janus: 'ack',
  session_id: 4401051734918689,
  transaction: 'prk1XnxsgryFm7Y1' } +1ms
  express:router dispatching POST /endpoint/xyz +17s
  express:router query  : /endpoint/xyz +0ms
  express:router expressInit  : /endpoint/xyz +0ms
  express:router serveStatic  : /endpoint/xyz +0ms
  express:router corsMiddleware  : /endpoint/xyz +0ms
  express:router jsonParser  : /endpoint/xyz +0ms
  body-parser:json content-type "application/sdp" +17s
  body-parser:json skip parsing +0ms
  express:router textParser  : /endpoint/xyz +0ms
  body-parser:text content-type "application/sdp" +1ms
  body-parser:text content-encoding "identity" +0ms
  body-parser:text read body +0ms
  body-parser:text parse body +0ms
  express:router textParser  : /endpoint/xyz +1ms
  body-parser:text body already parsed +0ms
  finalhandler default 404 +0ms
  janus:vdebug Sending message: { janus: 'keepalive',
  session_id: 4401051734918689,
  transaction: 'i8drjoOzv4RmOZ4L',
  apisecret: undefined } +15s

Client side:

c@fanless1 ~/o/j/simple-whip-client (main)> curl -H 'Content-Type: application/json' -d '{"id": "xyz", "room": 1234}' http://localhost:7080/whip/create
OK⏎
c@fanless1 ~/o/j/simple-whip-client (main)> docker run -it --rm -e "URL=http://172.17.0.1:7080/endpoint/xyz" simple-whip-client

--------------------
Simple WHIP client
------------------

WHIP endpoint:  http://172.17.0.1:7080/endpoint/xyz
Bearer Token:   (none)
Trickle ICE:    yes (HTTP PATCH)
Auto STUN/TURN: no
STUN server:    stun://stun.l.google.com:19302
TURN server:    (none)
Audio pipeline: audiotestsrc is-live=true wave=red-noise ! audioconvert ! audioresample ! queue ! opusenc ! rtpopuspay pt=100 ssrc=1 ! queue ! application/x-rtp,media=audio,encoding-name=OPUS,payload=100
Video pipeline: videotestsrc is-live=true pattern=ball ! videoconvert ! queue ! vp8enc deadline=1 ! rtpvp8pay pt=96 ssrc=2 ! queue ! application/x-rtp,media=video,encoding-name=VP8,payload=96

[WHIP] Initializing the GStreamer pipeline:
webrtcbin name=sendonly bundle-policy=3  stun-server=stun://stun.l.google.com:19302  videotestsrc is-live=true pattern=ball ! videoconvert ! queue ! vp8enc deadline=1 ! rtpvp8pay pt=96 ssrc=2 ! queue ! application/x-rtp,media=video,encoding-name=VP8,payload=96 ! sendonly. audiotestsrc is-live=true wave=red-noise ! audioconvert ! audioresample ! queue ! opusenc ! rtpopuspay pt=100 ssrc=1 ! queue ! application/x-rtp,media=audio,encoding-name=OPUS,payload=100 ! sendonly.
[WHIP] Configured jitter-buffer size (latency) for PeerConnection to 200ms
[WHIP] Starting the GStreamer pipeline
[WHIP] Creating offer
[WHIP] Offer created
[WHIP] Setting local description
[WHIP] Sending SDP offer (1232 bytes)
[ERR] [src/whip-client.c:whip_connect:722]  [404] Not Found
[WHIP] Disconnecting from server (HTTP error)
[WHIP] ICE gathering started...
[WHIP] GStreamer pipeline stopped

Bye!
c@fanless1 ~/o/j/simple-whip-client (main)>
cameronelliott commented 2 years ago

I was missing the /whip from /whip/endpoint/abc123. 🤫