stackblitz / webcontainer-core

Dev environments. In your web app.
https://webcontainers.io
MIT License
3.89k stars 161 forks source link

Media Serving Issue: Inconsistent Media Delivery with NodeJS and ExpressJS Web Server on StackBlitz #1278

Open iTSiolinux opened 10 months ago

iTSiolinux commented 10 months ago

Describe the bug

I've encountered a perplexing issue in my 2D game project on StackBlitz. The game relies on media served by a NodeJS backend using ExpressJS, and I've noticed intermittent failures in media delivery. Occasionally, the server fails to serve the required media assets, causing disruptions in the game's functionality.

Link to the blitz that caused the error

https://stackblitz.com/~/github.com/iTSiolinux/MineResource?view=editor

Steps to reproduce

  1. Open the Terminal:

    • Locate the "Terminal" on the left side in the StackBlitz editor.
  2. Run Server:

    • In the Terminal, type node server/index.js and press Enter to start the NodeJS server.
  3. Open Preview Tab:

    • Click on the "Preview" tab to view your game.
  4. Check for Image Loading Issues:

    • Observe the game for images that are not loading.
  5. Open Developer Tools:

    • Press F12 or right-click and select "Inspect" to open the browser's developer tools.
  6. Navigate to "Network" Tab:

    • Go to the "Network" tab.
  7. Check for Unsuccessful Requests:

    • Look for any unsuccessful image requests (e.g., oakTree.png not loading).

Expected behavior

The media should load and then the oakTree should apper on top of the player

Parity with Local

Screenshots

No response

Platform

Version = 1.84.0
Hash = a5b1ce2088a8c48a3bfda4a131ef20e00b36d9eb
WebContainer = a2aabdd9

Browser name  = Chrome
Full version  = 120.0.0.0
Major version = 120
navigator.appName = Netscape
navigator.userAgent = Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36
performance.memory = {
  "totalJSHeapSize": 146496069,
  "usedJSHeapSize": 95837765,
  "jsHeapSizeLimit": 4294705152
}

Additional context

it works sometimes (randomly)

SamVerschueren commented 9 months ago

Hey @iTSiolinux 👋 ! Thanks for reaching out!

Is it possible that the repository you linked here is private? Or that you deleted it? I'm unable to open it so I can't really see what the issue is.