Skip to content
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

Native node backend capabilities #32

Open
alper-batioglu opened this issue May 13, 2023 · 2 comments
Open

Native node backend capabilities #32

alper-batioglu opened this issue May 13, 2023 · 2 comments

Comments

@alper-batioglu
Copy link

Describe the bug
Hello, I am trying testing mongoDB connection from a webcontainer. But i was unable to get it working. After debugging I saw it gets stuck in dns.promises.resolveSrv call. It does not get resolved nor gets rejected. I checked the documentation and nothing mentions about native node limitations. So, I wonder if this is a bug or are there limitations.

To Reproduce
Steps to reproduce the behavior:

  1. Go to https://webcontainers.io/
  2. Click on 'index.js' editor portion of the page.
  3. paste the following script.
import dns from "dns";

dns.promises.resolveSrv('_mongodb._tcp.cluster0.cb93mrj.mongodb.net').then(() => console.log('then')).catch(() => console.log('catch'));

console.log(`Hello Node.js v${process.versions.node}!`);
setTimeout(() => console.log('time is up :('), 5000);
  1. Click on "Run index.js" or type "node index.js" in the terminal portion of the screen and press enter.
  2. See "Hello Node.js v16.14.2!" and "time is up :(" lines. But there is no catch neither then. Promise just gets vaporised.

Expected behavior
dns.promises.resolveSrv call returns a promise which should be either resolved or rejected.

Screenshots
image

Desktop (please complete the following information):

  • OS: MacOS Ventura 13.3.1 (a)
  • Browser: Microsoft Edge
  • Version: Version 113.0.1774.35 (Official build) (arm64)
@thienphanexcalibur
Copy link

It seems the DNS layer is not working in native node webcontainer

@thienphanexcalibur
Copy link

thienphanexcalibur commented Jun 25, 2023

@alper-batioglu
refer to this answer of webcontainer maintainer
stackblitz/webcontainer-core#1106 (comment)

we don't support databases like Mongo out of the box, b/c that would require something akin to low-level networking in the browser (e.g. TCP/UDP sockets, DNS, etc.), which don't currently exist. We are thinking about ways around this, but we don't have any concrete roadmap about it. If you're interested, we can leave this open as a venue for updates in case anything changes.

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

No branches or pull requests

2 participants