[go: up one dir, main page]

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: Can't assign requested address; toString() = 192.168.1.146:8788 #6899

Open
joseflekardal opened this issue Oct 5, 2024 · 5 comments
Labels
awaiting reporter response Needs clarification or followup from OP bug Something that isn't working

Comments

@joseflekardal
Copy link

Which Cloudflare product(s) does this pertain to?

Wrangler

What version(s) of the tool(s) are you using?

3.80.0 [wrangler]

What version of Node are you using?

20.17.0

What operating system and version are you using?

macOS Sequoia 15.0

Describe the Bug

Observed behavior

I am not able to run my pages functions locally using Wrangler CLI.

I am running on macOS Sequoia 15.0 but I've seen the same error on Ventura, I've also tried multiple earlier versions of wrangler but they all seem to behave the same way.

Wrangler tries to bind to 192.168.1.146:8788 which is a weird default (I dont use a wrangler.toml file in this example). If i force it to use --ip '127.0.0.1' the command starts just fine but no requests come through, the logs are completely empty.

Expected behavior

At this point I just want to see my hello world working.

Steps to reproduce

Command

wrangler pages dev . --log-level debug

Folder structure

.
└── functions
    └── hello.js

hello.js is the standard hello world:

export function onRequest(context) {
  return new Response("Hello, world!")
}

Please provide a link to a minimal reproduction

No response

Please provide any relevant error logs

 ⛅️ wrangler 3.80.0
-------------------

No experimental flag store instantiated
Attempted to use flag "JSON_CONFIG_FILE" which has not been instantiated
▲ [WARNING] No compatibility_date was specified. Using today's date: 2024-10-05.

  ❯❯ Add one to your wrangler.toml file: compatibility_date = "2024-10-05", or
  ❯❯ Pass it in your terminal: wrangler pages dev [<DIRECTORY>]
  --compatibility-date=2024-10-05
  
  See https://developers.cloudflare.com/workers/platform/compatibility-dates/ for more
  information.


Compiling worker to "/Users/username/project-name/.wrangler/tmp/pages-HFK0hz/functionsWorker-0.3034340515603402.mjs"...
✨ Compiled Worker successfully
Retrieving cached values for userId from node_modules/.cache/wrangler
Metrics dispatcher: Posting data {"type":"event","name":"build pages functions","properties":{}}
Using vars defined in .dev.vars
Metrics dispatcher: Posting data {"type":"event","name":"run dev","properties":{"local":true,"usesTypeScript":false}}
⎔ Starting local server...
workerd/util/symbolizer.c++:101: warning: Not symbolizing stack traces because $LLVM_SYMBOLIZER is not set. To symbolize stack traces, set $LLVM_SYMBOLIZER to the location of the llvm-symbolizer binary. When running tests under bazel, use `--test_env=LLVM_SYMBOLIZER=<path>`.
*** Fatal uncaught kj::Exception: kj/async-io-unix.c++:945: failed: ::bind(sockfd, &addr.generic, addrlen): Can't assign requested address; toString() = 192.168.1.146:8788
stack: 1100630bb 110062e59 11006120d 10d439185 10d439a0e 10d43a25a 10d43a96f 10d3db70f 110090e8d 11009109d 11008f688 11008f3a5 10d3c81e0 /usr/lib/dyld@62cc
Error in ProxyController: Could not connect to InspectorProxyWorker
 MiniflareCoreError [ERR_RUNTIME_FAILURE]: The Workers runtime failed to start. There is likely additional logging output above.
    at #assembleAndUpdateConfig (/Users/username/.nvm/versions/node/v20.17.0/lib/node_modules/wrangler/node_modules/miniflare/dist/src/index.js:9828:13)
    at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
    at async Mutex.runWith (/Users/username/.nvm/versions/node/v20.17.0/lib/node_modules/wrangler/node_modules/miniflare/dist/src/index.js:3627:16) {
  code: 'ERR_RUNTIME_FAILURE',
  cause: undefined
}
=> Error contextual data: {
  config: {
    name: 'worker',
    compatibilityDate: '2024-10-05',
    compatibilityFlags: [],
    entrypoint: '/Users/username/project-name/.wrangler/tmp/pages-HFK0hz/functionsWorker-0.3034340515603402.mjs',
    directory: '/Users/username/project-name',
    bindings: {},
    migrations: [],
    triggers: [],
    env: undefined,
    build: {
      additionalModules: [],
      processEntrypoint: true,
      bundle: true,
      findAdditionalModules: undefined,
      minify: undefined,
      moduleRules: [],
      define: {},
      custom: [Object],
      jsxFactory: 'React.createElement',
      jsxFragment: 'React.Fragment',
      tsconfig: undefined,
      nodejsCompatMode: null,
      format: 'modules',
      moduleRoot: '/Users/username/project-name/.wrangler/tmp/pages-HFK0hz'
    },
    dev: {
      auth: [AsyncFunction: auth],
      remote: false,
      server: [Object],
      inspector: [Object],
      origin: [Object],
      liveReload: false,
      testScheduled: false,
      persist: ''
    },
    legacy: {
      site: undefined,
      legacyAssets: undefined,
      enableServiceEnvironments: false
    },
    unsafe: { capnp: undefined, metadata: undefined }
  },
  bundle: undefined
}
ProxyWorker miniflare options changed, reinstantiating...
Error in ProxyController: Failed to send message to InspectorProxyWorker: {"type":"reloadStart"}
 MiniflareCoreError [ERR_RUNTIME_FAILURE]: The Workers runtime failed to start. There is likely additional logging output above.
    at #assembleAndUpdateConfig (/Users/username/.nvm/versions/node/v20.17.0/lib/node_modules/wrangler/node_modules/miniflare/dist/src/index.js:9828:13)
    at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
    at async Mutex.runWith (/Users/username/.nvm/versions/node/v20.17.0/lib/node_modules/wrangler/node_modules/miniflare/dist/src/index.js:3627:16) {
  code: 'ERR_RUNTIME_FAILURE',
  cause: undefined
}
=> Error contextual data: {
  config: {
    name: 'worker',
    compatibilityDate: '2024-10-05',
    compatibilityFlags: [],
    entrypoint: '/Users/username/project-name/.wrangler/tmp/pages-HFK0hz/functionsWorker-0.3034340515603402.mjs',
    directory: '/Users/username/project-name',
    bindings: {},
    migrations: [],
    triggers: [],
    env: undefined,
    build: {
      additionalModules: [],
      processEntrypoint: true,
      bundle: true,
      findAdditionalModules: undefined,
      minify: undefined,
      moduleRules: [],
      define: {},
      custom: [Object],
      jsxFactory: 'React.createElement',
      jsxFragment: 'React.Fragment',
      tsconfig: undefined,
      nodejsCompatMode: null,
      format: 'modules',
      moduleRoot: '/Users/username/project-name/.wrangler/tmp/pages-HFK0hz'
    },
    dev: {
      auth: [AsyncFunction: auth],
      remote: false,
      server: [Object],
      inspector: [Object],
      origin: [Object],
      liveReload: false,
      testScheduled: false,
      persist: ''
    },
    legacy: {
      site: undefined,
      legacyAssets: undefined,
      enableServiceEnvironments: false
    },
    unsafe: { capnp: undefined, metadata: undefined }
  },
  bundle: undefined
}
╭────────────────────────────────────────────────────────────────────────────────────────────╮
│ [b] open a browser, [d] open Devtools, [c] clear console, [x] to exit                      │
╰────────────────────────────────────────────────────────────────────────────────────────────╯
/Users/username/.nvm/versions/node/v20.17.0/lib/node_modules/wrangler/wrangler-dist/cli.js:29768
            throw a;
            ^

MiniflareCoreError [ERR_RUNTIME_FAILURE]: The Workers runtime failed to start. There is likely additional logging output above.
    at #assembleAndUpdateConfig (/Users/username/.nvm/versions/node/v20.17.0/lib/node_modules/wrangler/node_modules/miniflare/dist/src/index.js:9828:13)
    at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
    at async Mutex.runWith (/Users/username/.nvm/versions/node/v20.17.0/lib/node_modules/wrangler/node_modules/miniflare/dist/src/index.js:3627:16) {
  code: 'ERR_RUNTIME_FAILURE',
  cause: undefined
}
@joseflekardal joseflekardal added the bug Something that isn't working label Oct 5, 2024
@github-project-automation github-project-automation bot moved this to Untriaged in workers-sdk Oct 8, 2024
@lrapoport-cf lrapoport-cf added pages Relating to Pages pages-dev Relating to `pages dev` command labels Oct 14, 2024
@emily-shen
Copy link
Contributor
emily-shen commented Nov 11, 2024

Hey sorry for the delay getting back! This is really odd and not something we've seen before. I suspect this might have something to do your with your setup locally unfortunately. Does this also happen with a regular workers project, (e.g. if you create a basic hello-world project using npx create-cloudflare@latest), or if you use a different dev tool like vite?

@emily-shen emily-shen added the awaiting reporter response Needs clarification or followup from OP label Nov 11, 2024
@joseflekardal
Copy link
Author
joseflekardal commented Nov 12, 2024

Thank you for replying!

I get the same error when I create a new hello world app with npx create-cloudflare@latest and run it with npm run dev.

I tried running it with vite as you suggested, not sure I did it right though:

  1. npm install vite
  2. updated the dev script in package.json to vite dev
  3. ran it with npm run dev

This is the output I got and the endpoint http://localhost:5173 gave 404:

➜  black-flower-39ce git:(main) ✗ npm run dev

> black-flower-39ce@0.0.0 dev
> vite dev


  VITE v5.4.11  ready in 148 ms

  ➜  Local:   http://localhost:5173/
  ➜  Network: use --host to expose
  ➜  press h + enter to show help
(!) Could not auto-determine entry point from rollupOptions or html files and there are no explicit optimizeDeps.include patterns. Skipping dependency pre-bundling.

@emily-shen
Copy link
Contributor

Thanks for trying that, helpful to know that it's not Pages-specific. Can you create a starter remix project following this (https://developers.cloudflare.com/workers/frameworks/framework-guides/remix/) and run npm run dev - that'll use vite not wrangler, so we can figure out if it's a wrangler issue or more general.

@emily-shen emily-shen removed pages Relating to Pages pages-dev Relating to `pages dev` command labels Nov 12, 2024
@joseflekardal
Copy link
Author

Sure!

Not sure what to look for but the dev server starts and the remix landing page is working great.

@CarmenPopoviciu CarmenPopoviciu added awaiting Cloudflare response Awaiting response from workers-sdk maintainer team and removed awaiting reporter response Needs clarification or followup from OP labels Nov 18, 2024
@emily-shen
Copy link
Contributor

Hm this is very odd. Have you got anything special set up in your hosts file? If you run ping localhost does that resolve to 127.0.0.1?

@emily-shen emily-shen added awaiting reporter response Needs clarification or followup from OP and removed awaiting Cloudflare response Awaiting response from workers-sdk maintainer team labels Nov 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting reporter response Needs clarification or followup from OP bug Something that isn't working
Projects
Status: Untriaged
Development

No branches or pull requests

4 participants