prismicio / slice-machine

A series of tools for developing and deploying website sections with Prismic
https://prismic.io/docs
Apache License 2.0
287 stars 53 forks source link

Slice-machine cannot be reached, if running within a sandbox #1336

Closed lure23 closed 6 months ago

lure23 commented 6 months ago

Problem

I run development tools not locally, but in a VM sandbox. Slice-machine does not seem usable in this scenario. These lines show that the port can be customized, but the localhost is hardcoded.

The normal way to work in the sandboxed scenario (e.g. with SvelteKit) is to use --host 0.0.0.0 (or similar), which enables hosting outside of the sandboxes internal environment.

Is there an existing work-around to continue learning Slice-machine? I am evaluating Prismic.

angeloashmore commented 6 months ago

Hi @lure23, could you explain your VM sandbox setup with specifics?

In case you are not familiar, Slice Machine directly interacts with the filesystem. When a new content type is created (e.g. a page type, a custom type, a slice), several files are created within your project. If the Slice Machine server is running on the server with write access, it should work as you expect.

Thanks!

lure23 commented 6 months ago

It’s the same as https://github.com/prismicio/prismic-cli/issues/176 (Sep ‘22). If you fixed that, I would have not had a problem.

It’s not specific to any single VM, but common to all. I am using Multipass - but also tried WSL2. There’s no way I am installing npm on my main accounts, but that’s what you currently seem to require. I think sandboxing is not a quirk any more; should be the mainstream. The issue here is that the localhost of the VM is not reachable from the desktop OS (where browser lives).

I’ve moved on from Prismic (don’t really need it). For example Cloudflare wrangler CLI can be used as a sample on how to do this decently. In addition to allowing one to open a browser, they also print out the URL that needs to get opened. Almost any developer can take it from there. Contrast this with the experience Prismic gives. It claims to have opened a browser (which is fake; there’s no browser in the Linux VM I had). Not only is it a lack of info, but misleading as well.

All of this is something you can fix.