Experiencing An Error 502 (Newbie not too sure what it indicates)
Hi! This is my first time working with Deno (or deploying anything myself) and for some reason I get the error as shown on the screenshot attached when I try to deploy this repo (https://github.com/v1peridae/viperchat) using the feature that connects to GitHub. It runs perfectly fine when I run it on the local Deno. To replicate it I think you can fork the repo then run it on Deno Deploy. I'm not really how to solve it and I would really appreciate assistance :) Thank you!
GitHub
GitHub - v1peridae/viperchat
Contribute to v1peridae/viperchat development by creating an account on GitHub.
4 Replies
Get rid of the
std@0.75
imports. That's a super ancient version from a couple years back that uses APIs that don't exist anymore. Maybe you're running on a very old version of Deno where these still exist? Run deno upgrade
locally to update to the newest version (1.45.5).
Instead of the std imports, you should be using Deno.serve
directly to spawn the web server and use Deno.upgradeWebSocket()
to establish a websocket connection, see https://docs.deno.com/examples/http-server-websocket/ .Hi, thanks for helping out! I was following a tutorial made in 2020 so that could be why. Should I simply get rid of the first 2 lines. As for using the web socket, do you recommend any tutorial on working with websockets since I’m still having quite some trouble understanding the process. Thank you so much!!
The very first Deno release was in 2020 so anything from that time is pretty dated. Here is a great (short) tutorial for how to set up a websocket server in Deno https://docs.deno.com/examples/http-server-websocket/
Thanks! I’ll let you know when it works :D
Update! So I was told that what I’m trying to deploy at the moment may not work even with fixed code since Deno Deploy only has stateless functions. I do appreciate the help lots :D