Skip to content

Cannot connect to studio.rivet.gg with examples #941

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
valstu opened this issue Apr 23, 2025 · 4 comments · May be fixed by #943
Open

Cannot connect to studio.rivet.gg with examples #941

valstu opened this issue Apr 23, 2025 · 4 comments · May be fixed by #943
Assignees

Comments

@valstu
Copy link

valstu commented Apr 23, 2025

When running npx create-actor@latest actor-core-bug after creating example project with npx create-actor the studio.rivet.gg opens up but it cannot connect to the server.

Image

Server seems to be running ok:

Image

Background

We had a chat yesterday with @NathanFlurry on X about my issue, so I decided to create this issue so it is easier to communicate here on Github. First of all, here is link to repo https://github.com/valstu/actor-core-bug so you can try it out. I created the repo like this:

  • I created a project with command npx create-actor@latest actor-core-bug
  • Selected Node.js as platform
  • Selected Counter project as an example project
  • I ran npx create-actor@latest actor-core-bug
  • Studio opens up but it cannot connect to the server

What I've tested out

When I enabled the inspector on the https://github.com/valstu/actor-core-bug/blob/main/actors/app.ts file like this:

export const app = setup({
	actors: { counter },
	inspector: {
		enabled: true,
	}
});

and ran the npx tsx src/index.ts and then opened up the studio.rivet.gg on the browser it starts to work. Then I'm able to connect to the server.

I also noticed that if I change the app.ts to following:

export const app = setup({
	actors: { counter },
	inspector: {
		enabled: true,
	},
	cors: {
		origin: (origin) => origin
	}
});

As is done on the cli code here

config.app.config.cors = {
origin: (origin) => origin,
};

And run npx tsx src/index.ts The same problem appears again. And I cannot connect to server anymore.

Copy link

linear bot commented Apr 23, 2025

@valstu
Copy link
Author

valstu commented Apr 23, 2025

I modified the cli code locally so that I removed the cors part from server-entry.ts mentioned above and it started working 🤔

@jog1t jog1t self-assigned this Apr 23, 2025
@valstu
Copy link
Author

valstu commented Apr 24, 2025

So I spent few hours debugging this today. My gut told me this is related to cors somehow and while trying to figuring out how to disable cors for all websocket routes, I bumped into this issue honojs/hono#4090 and I suspect this might be causing issues for us as well.

I also downgraded hono to v 4.7.6 and everything started working 🤔

@jog1t
Copy link
Collaborator

jog1t commented Apr 26, 2025

@valstu hey, really appraciate your input on this issue. It turned out, that I forgot about the issue you have linked indeed! Disabled the CORS for websockets routes just for now (we're doing the same on actors side). Tested it by myself and its working! Would you like to give it a try? #943

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants