sanity-io / visual-editing

https://visual-editing-studio.sanity.build
MIT License
36 stars 21 forks source link

Hydrogen dev command fails with @sanity/visual-editing import #2113

Closed thomasKn closed 1 day ago

thomasKn commented 5 days ago

Describe the bug

When importing the VisualEditing component from @sanity/visual-editing/remix (version 2.5.1), the Hydrogen dev command fails to start, resulting in a MiniflareCoreError. The issue occurs in a Hydrogen non-Vite app.

MiniflareCoreError [ERR_RUNTIME_FAILURE]: The Workers runtime failed to start. There is likely additional logging output above.
    at #assembleAndUpdateConfig (/Users/thomascristinadecarvalho/Downloads/hhhh/node_modules/.pnpm/miniflare@3.20241022.0/node_modules/miniflare/dist/src/index.js:9980:13)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async Mutex.runWith (/Users/thomascristinadecarvalho/Downloads/hhhh/node_modules/.pnpm/miniflare@3.20241022.0/node_modules/miniflare/dist/src/index.js:3632:16)
    at async #waitForReady (/Users/thomascristinadecarvalho/Downloads/hhhh/node_modules/.pnpm/miniflare@3.20241022.0/node_modules/miniflare/dist/src/index.js:10037:5)
    at async startWorkerdServer (file:///Users/thomascristinadecarvalho/Downloads/hhhh/node_modules/.pnpm/@shopify+cli@3.69.4/node_modules/@shopify/cli/dist/workerd-YWTPL4SF.js:141:37)
    at async safeStartMiniOxygen (file:///Users/thomascristinadecarvalho/Downloads/hhhh/node_modules/.pnpm/@shopify+cli@3.69.4/node_modules/@shopify/cli/dist/index.js:155757:18)
    at async onBuildFinish (file:///Users/thomascristinadecarvalho/Downloads/hhhh/node_modules/.pnpm/@shopify+cli@3.69.4/node_modules/@shopify/cli/dist/index.js:155809:78)

To Reproduce

I published a reproduction repo here. The main branch is a non-vite Hydrogen app. The npm run dev command should fail to start, resulting in a MiniflareCoreError. I also pushed a vite branch that doesn't have the issue.

Which versions of Sanity are you using?

@sanity/cli (global)    3.63.0 (up to date)
@sanity/visual-editing   2.5.1 (up to date)

What operating system are you using?

macOS 15.0.1

Which versions of Node.js / npm are you running?

10.8.2 v20.18.0

stipsan commented 5 days ago

@thomasKn thanks for sharing the repro! I've tested on my end and the error seems to be gone ✨ But I haven't setup any env vars so I couldn't get Hydrogen to actually load, can you test https://github.com/sanity-io/visual-editing/releases/tag/visual-editing-v2.5.2 on your end and tell me if it's resolved for you?

thomasKn commented 5 days ago

I can confirm it's working now, thanks @stipsan!

stipsan commented 1 day ago

Great to hear!