workers-sdk icon indicating copy to clipboard operation
workers-sdk copied to clipboard

🐛 BUG: Unable to login via OAuth (Error: ENOENT: no such file or directory, open 'C:\Users\korde\AppData\Roaming\xdg.config\.wrangler\config\default.toml')

Open korDen opened this issue 2 years ago • 4 comments

Which Cloudflare product(s) does this pertain to?

Wrangler core

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

wrangler 3.18.0

What version of Node are you using?

Node.js v21.3.0

What operating system are you using?

Windows

Describe the Bug

Trying to run wrangler r2 bucket list per cloudflare docs. This opens a webbrowser with the sign in and Accept button. Pressing the accept button errors out:

C:\Users\korde>npx wrangler r2 bucket list
Attempting to login via OAuth...
Opening a link in your default browser: https://dash.cloudflare.com/oauth2/auth?response_type=...
C:\Users\korde\node_modules\wrangler\wrangler-dist\cli.js:29374
            throw a;
            ^

Error: ENOENT: no such file or directory, open 'C:\Users\korde\AppData\Roaming\xdg.config\.wrangler\config\default.toml'
    at writeFileSync (node:fs:2352:20)
    at writeAuthConfigFile (C:\Users\korde\node_modules\wrangler\wrangler-dist\cli.js:119084:37)
    at Server.<anonymous> (C:\Users\korde\node_modules\wrangler\wrangler-dist\cli.js:119173:13)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
  errno: -4058,
  code: 'ENOENT',
  syscall: 'open',
  path: 'C:\\Users\\korde\\AppData\\Roaming\\xdg.config\\.wrangler\\config\\default.toml'
}

Node.js v21.3.0

Please provide a link to a minimal reproduction

No response

Please provide any relevant error logs

No response

korDen avatar Dec 04 '23 01:12 korDen

Tried creating a blank default.toml (which didn't exist), getting this now:

C:\Users\korde\node_modules\wrangler\wrangler-dist\cli.js:29374
            throw a;
            ^

Error: EBADF: bad file descriptor, write
    at writeFileSync (node:fs:2352:20)
    at writeAuthConfigFile (C:\Users\korde\node_modules\wrangler\wrangler-dist\cli.js:119084:37)
    at Server.<anonymous> (C:\Users\korde\node_modules\wrangler\wrangler-dist\cli.js:119173:13)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
  errno: -4083,
  code: 'EBADF',
  syscall: 'write'
}

Node.js v21.3.0```

korDen avatar Dec 04 '23 01:12 korDen

I think the problem was caused by node v21. Downgrading to node v19 worked for me 😕

patamimbre avatar Dec 14 '23 18:12 patamimbre

I think this is a duplicate issue of #4540. The problem seems to be with node v21.3.0. Updating to 21.4.0 from 21.3.0 fixed it for me. However, that issue was closed, so maybe a good idea to leave this one open until a solution is determined.

mackenly avatar Dec 16 '23 00:12 mackenly

@korDen can you confirm whether or not this is still an issue?

andyjessop avatar Jun 28 '24 08:06 andyjessop

We haven't heard from you in while so I'm going to close this issue for now. If you're still running into problems feel free to comment with more details and we can investigate further.

penalosa avatar Jul 08 '24 13:07 penalosa