"pxt serve" conflates hostname with network address
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 2.3k
- Forks
- 641
- Avg merge
- 12h 4m
- Merged PRs (30d)
- 57
Description
Bug Template
Describe the bug
The documentation for pxt serve lists a --hostname parameter that can be used to specify the hostname to listen for. This can be useful when running pxt serve in a Docker container, or in any form where a remote person may want to connect but the external hostname is different from the local hostname.
To Reproduce
Steps to reproduce the behavior:
- Map an external address to your host (for example, through Docker, or from behind a NAT)
- Give the external address a hostname
- Run
pxt serve --hostname [external-hostname] - See error
Expected behavior
The hostname is different from the bind address. The server should either have a separate flag for "bind address", or it should bind to "0.0.0.0".
Screenshots
[8:12:15 PM] D:/Code/makecode/pxt-chibitronics> pxt serve --hostname makecode-dev.xobs.io
Using target PXT/chibitronics with build engine platformio
Target dir: D:\Code\makecode\pxt-chibitronics
PXT Core dir: D:\Code\makecode\pxt-chibitronics\node_modules\pxt-core
log strings: 34 files; 0 strings -> sim-strings.json
error TS6053: File 'D:/Code/makecode/pxt-chibitronics/node_modules/pxt-core/built/lib.dom.d.ts' not found.
error TS6053: File 'D:/Code/makecode/pxt-chibitronics/node_modules/pxt-core/built/lib.dom.iterable.d.ts' not found.
error TS6053: File 'D:/Code/makecode/pxt-chibitronics/node_modules/pxt-core/built/lib.es2015.d.ts' not found.
error TS6053: File 'D:/Code/makecode/pxt-chibitronics/node_modules/pxt-core/built/lib.scripthost.d.ts' not found.
error TS2318: Cannot find global type 'Array'.
error TS2318: Cannot find global type 'Boolean'.
error TS2318: Cannot find global type 'Function'.
error TS2318: Cannot find global type 'IArguments'.
error TS2318: Cannot find global type 'Number'.
error TS2318: Cannot find global type 'Object'.
error TS2318: Cannot find global type 'RegExp'.
error TS2318: Cannot find global type 'String'.
building target.json in D:\Code\makecode\pxt-chibitronics...
building docs in libs/core
Package built; written to binary.hex; size: 0
generated _locales\core-strings.json; size=4168
generated _locales\core-jsdoc-strings.json; size=13819
building docs in libs/scope
Package built; written to binary.hex; size: 0
generated _locales\scope-strings.json; size=160
generated _locales\scope-jsdoc-strings.json; size=370
building libs/core
skip native build of non-project
building libs/scope
skip native build of non-project
building libs\blocksprj
target.json built.
building sim...
[run] cd sim; node ../node_modules/typescript/bin/tsc
building cmds...
[run] cd cmds; node ../node_modules/typescript/bin/tsc
building editor...
[run] cd editor; node ../node_modules/typescript/bin/tsc
watching D:\Code\makecode\pxt-chibitronics\node_modules\pxt-core, libs/core, libs/scope, theme, theme\site\globals, editor, sim, sim\public, sim\state, sim\visuals, sim, cmds, editor...
Starting server in D:\Code\makecode\pxt-chibitronics
With pxt core at D:\Code\makecode\pxt-chibitronics\node_modules\pxt-core
starting local ws server at 3233...
INTERNAL ERROR: Error: listen EADDRNOTAVAIL: address not available 132.147.96.146:3233
at Server.setupListenHandle [as _listen2] (net.js:1239:19)
at listenInCluster (net.js:1304:12)
at GetAddrInfoReqWrap.doListen [as callback] (net.js:1443:7)
at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:63:10)
[8:12:41 PM] D:/Code/makecode/pxt-chibitronics>
Additional context
This is work that's being done in order to share C++ changes with designers who do not have a pxt development environment installed.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the pxt serve entry point and trace how --hostname is passed to the network listener. Reproduce the failure with an externally resolvable hostname, then verify that the advertised hostname is separated from the bind address or that binding uses 0.0.0.0; add or update coverage for the behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- node.js, typescript
- Domain
- cli, networking
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100