azure-webpubsub icon indicating copy to clipboard operation
azure-webpubsub copied to clipboard

Passing connection option to event handler

Open Cytranics opened this issue 2 years ago • 6 comments

Describe the bug

Not sure if this is a bug or not, but after 5 days, 10 hours a day i feel compelled to post this. The connect function to send to event handler does not seem to work at all with any examples. I constantly get a "Request server is denied as target server is invalid."

I've gone through the entire server sdk and I cant see where the handshake is failing.

In additional it never seems to pass CORS. Copy and pasting example does not work. Implementing CORS properly doesnt work.

To Reproduce

Copy and past chat code, dev code, all samples of handling connect option into a new pub sub.

We will close this issue if:

  • the repro project you share with us is complex. We can't investigate custom projects, so don't point us to such, please.
  • if we will not be able to repro the behavior you're reporting --> https://github.com/Azure/azure-webpubsub/blob/main/samples/javascript/chatapp/sdk/server.js

Exceptions (if any)

Further technical details

-javascript, repo is above

Cytranics avatar Mar 30 '23 10:03 Cytranics

Hi @Cytranics , have you configured the event handler settings? What tunnel tool are you using to expose your localhost to public?

vicancy avatar Apr 12 '23 03:04 vicancy

Hi @Cytranics , have you configured the event handler settings? What tunnel tool are you using to expose your localhost to public?

Not for the connect. I have an azure web app so no tunnel, using node.js... I copy and paste your exact example and it does not authenticate. I have a feeling it wasnt passing the correct headers to authenticate via the Webhook Orgin. With that said, I really didnt need a connect handshake in the end, and ended up just using connected event.

Cytranics avatar Apr 12 '23 09:04 Cytranics

I copy and paste your exact example and it does not authenticate.

How did you setup the event handlers in your portal? The sample does not need to configure connect so the event handler code does not handle the connect event (handleEvent), so if you configured connect event in your portal it actually fails because no upstream handles the event.

vicancy avatar Apr 14 '23 07:04 vicancy

Facing the same issue. Event handler is not being called. When checked in Live Trace Tool, it always shows the Abuse protection and Connection Exception. The outbound traffic from Web PubSub service is restricted by default I guess. Not sure how to enable it, although enabled full network access.

image

image

nidri avatar May 03 '24 17:05 nidri

Facing the same issue. Event handler is not being called. When checked in Live Trace Tool, it always shows the Abuse protection and Connection Exception. The outbound traffic from Web PubSub service is restricted by default I guess. Not sure how to enable it, although enabled full network access.

image

image

Have you configured any authenticate middleware in your app server? Is your app server accessible if you curl https://<your_web_app_host>/<your_eventhandler_path_as_configured> -X OPTIONS -H "WebHook-Request-Origin: *" -H "ce-awpsversion: 1.0" --ssl-no-revoke -i?

vicancy avatar May 08 '24 08:05 vicancy

Facing the same issue. Event handler is not being called. When checked in Live Trace Tool, it always shows the Abuse protection and Connection Exception. The outbound traffic from Web PubSub service is restricted by default I guess. Not sure how to enable it, although enabled full network access. image image

Have you configured any authenticate middleware in your app server? Is your app server accessible if you curl https://<your_web_app_host>/<your_eventhandler_path_as_configured> -X OPTIONS -H "WebHook-Request-Origin: *" -H "ce-awpsversion: 1.0" --ssl-no-revoke -i?

We suspect it could be a firewall thing. We changed to a different publicly available URL and the events were being sent. It is something with our original URL we have to deal with .

Thanks for your insights @vicancy

nidri avatar May 08 '24 22:05 nidri