prismicio/slice-machine

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

Closed this issue · 2 comments

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.

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

  • What service or software are you using to run your sandbox?
  • Could you share other packages/frameworks you use with --host 0.0.0.0 that work? It may help us if we need to check how their implement their servers.

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!

It’s the same as prismicio/prismic-cli#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.