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

🐛 BUG: unstable_dev inspect and inspector_port appear not to work #2453

Closed
JustinGrote opened this issue Dec 24, 2022 · 6 comments
Closed
Assignees
Labels
bug Something that isn't working needs reproduction Needs reproduction from OP

Comments

@JustinGrote
Copy link

What version of Wrangler are you using?

2.6.2

What operating system are you using?

Windows

Describe the Bug

describe('UnstableDevWorker', () => {
	let worker: UnstableDevWorker
	let base: string

	beforeAll(async () => {
		worker = await unstable_dev(
			'src/worker.ts',
			{ inspect: true, inspectorPort: 39929 },
			{ disableExperimentalWarning: true }
		)
		base = 'http://' + worker.address + ':' + worker.port
	})

netstat never shows 39929 opening even when pausing the debugger or leaving a long wait in the test. This is preventing me from debugging inside of unstable_dev and makes it much less useful. I use hono router in front of it and tend to use that instead so I can debug inside the "worker" itself, I would like to be able to use unstable_dev in vscode for this however

Success Criteria

Be able to set a breakpoint within Visual Studio code using a test in vitest with unstable_dev and have it pause on the breakpoint inside the worker when calling fetch

@JustinGrote JustinGrote added the bug Something that isn't working label Dec 24, 2022
@workers-devprod workers-devprod moved this to Untriaged in workers-sdk Dec 24, 2022
@JacobMGEvans JacobMGEvans moved this from Untriaged to Selected for Development in workers-sdk Dec 28, 2022
@JacobMGEvans
Copy link
Contributor

JacobMGEvans commented Dec 28, 2022

If you could provide a minimal repro, maybe with Hono, that would help immensely to get to it sooner.

@JacobMGEvans JacobMGEvans added the needs reproduction Needs reproduction from OP label Dec 28, 2022
@JacobMGEvans JacobMGEvans self-assigned this Dec 28, 2022
@penalosa
Copy link
Contributor

We're going to close this for now, but feel free to comment here with a minimal reproduction and we can investigate further. It's also possible this has been fixed in recent versions of Wrangler, as unstable_dev is undergoing fairly active development.

@penalosa penalosa closed this as not planned Won't fix, can't repro, duplicate, stale Jan 23, 2023
@github-project-automation github-project-automation bot moved this from Selected for Development to Done in workers-sdk Jan 23, 2023
@ThomasHambach
Copy link

Hi @penalosa , Commented on wrong issue before.I am actually running into the same issue. The reproduction is quite simple. This is on wrangler 3.4

await unstable_dev('index.ts'), {
        port: 42000,
        local: true,
        inspectorPort: 42001,
        inspect: true,
        compatibilityDate: "2023-03-14",
        logLevel: "debug",
        experimental: {
            disableExperimentalWarning: true,
            watch: false
        }
    });
await server.start();

Trying to connect using devtools will not work. Running netstat -an | findstr :42001 shows no active connections.

I am trying to see where unstable_dev and the regular startServer diverge. But perhaps you know where to look.

@frankichiro
Copy link

I am also having this issue, on Linux.

@JustinGrote
Copy link
Author

JustinGrote commented Oct 13, 2023

As an update, using Wrangler v3 (which uses workerd formerly known as unstable_dev) and this configuration, should work fine:
#4174

@JustinGrote
Copy link
Author

JustinGrote commented Oct 14, 2023

@penalosa still having this issue even with latest wrangler commit dc16f4e, here is a repro:
inspectorPort does not actually open the port when requested.

Test (vitest)

import { describe, expect, it } from 'vitest'
import { unstable_dev } from 'wrangler'

describe('Unstable Dev No Inspector Test', () => {
	it('should open inspect on custom port', async () => {
		const worker = await unstable_dev('src/worker.ts', {
			inspect: true,
			inspectorPort: 10000,
			ip: '127.0.0.1', //Just to make sure IPv6 isn't used
		})

		console.log(worker.address)
		console.log(worker.port)
		const x = await worker.fetch('index.json')
		expect(true).toBeTruthy()
	})
})

image

Notes

  • wrangler dev works fine

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something that isn't working needs reproduction Needs reproduction from OP
Projects
None yet
Development

No branches or pull requests

5 participants