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: wrangler secret:bulk command broke (again) when worker has DO bindings #5753

Open
izidormaklary opened this issue May 3, 2024 · 0 comments
Labels
bug Something that isn't working

Comments

@izidormaklary
Copy link

Which Cloudflare product(s) does this pertain to?

Wrangler core

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

3.53.1[Wrangler]

What version of Node are you using?

20.10.0

What operating system and version are you using?

Mac Sonoma 14.1.1

Describe the Bug

Observed behavior

wrangler secret:bulk fails when trying to upload secrets to a worker with Durable Object binding.
Not the first time it occurs: #4496.
Although there is mention of the:

Failed to load .env file ".env.dev": Error: ENOENT: no such file or directory, open '.env.dev'

log line it seems irrelevant, but the response to the patch request (originally sanitized from the logs) saying:

{
      "code": 10061,
      "message": "Cannot create binding for class DurableObject that is not exported by the script"
}

indicates that the issue with durable objects and secret:bulk resurfaced.

It's important to note that it only occurs with existing workers, there is no issue when uploading secrets to a brand new worker

Expected behavior

It should upload secrets regardless of durable object bindings.

Steps to reproduce

  • deploy a worker with at least one DO binding
  • try to use the wrangler secret:bulk command on the env you already deployed once

Please provide a link to a minimal reproduction

No response

Please provide any relevant error logs

--- 2024-05-03T12:38:19.820Z debug
🪵  Writing logs to " /User/root/.wrangler/logs/wrangler-2024-05-03_12-38-19_721.log"
---

--- 2024-05-03T12:38:19.820Z debug
Failed to load .env file ".env.dev": Error: ENOENT: no such file or directory, open '.env.dev'
    at Object.openSync (node:fs:581:18)
    at Object.readFileSync (node:fs:457:35)
    at tryLoadDotEnv (/User/root/node_modules/wrangler/wrangler-dist/cli.js:158790:72)
    at loadDotEnv (/User/root/node_modules/wrangler/wrangler-dist/cli.js:158801:12)
    at /User/root/node_modules/wrangler/wrangler-dist/cli.js:200143:20
    at /User/root/node_modules/wrangler/wrangler-dist/cli.js:165196:16
    at maybeAsyncResult (/User/root/node_modules/wrangler/wrangler-dist/cli.js:163417:44)
    at /User/root/node_modules/wrangler/wrangler-dist/cli.js:165195:14
    at /User/root/node_modules/wrangler/wrangler-dist/cli.js:163404:22
    at Array.reduce (<anonymous>) {
  errno: -2,
  code: 'ENOENT',
  syscall: 'open',
  path: '.env.dev'
}
---

--- 2024-05-03T12:38:19.821Z debug
Failed to load .env file ".env": Error: ENOENT: no such file or directory, open '.env'
    at Object.openSync (node:fs:581:18)
    at Object.readFileSync (node:fs:457:35)
    at tryLoadDotEnv (/User/root/node_modules/wrangler/wrangler-dist/cli.js:158790:72)
    at loadDotEnv (/User/root/node_modules/wrangler/wrangler-dist/cli.js:158801:50)
    at /User/root/node_modules/wrangler/wrangler-dist/cli.js:200143:20
    at /User/root/node_modules/wrangler/wrangler-dist/cli.js:165196:16
    at maybeAsyncResult (/User/root/node_modules/wrangler/wrangler-dist/cli.js:163417:44)
    at /User/root/node_modules/wrangler/wrangler-dist/cli.js:165195:14
    at /User/root/node_modules/wrangler/wrangler-dist/cli.js:163404:22
    at Array.reduce (<anonymous>) {
  errno: -2,
  code: 'ENOENT',
  syscall: 'open',
  path: '.env'
}
---

--- 2024-05-03T12:38:19.826Z log
 ⛅️ wrangler 3.53.1
�[38;2;255;136;0m-------------------�[39m
---

--- 2024-05-03T12:38:19.831Z log
🌀 Creating the secrets for the Worker "worker-name-dev" 
---

--- 2024-05-03T12:38:19.831Z debug
-- START CF API REQUEST: GET https://api.cloudflare.com/client/v4/accounts/{accountId}/workers/scripts/worker-name-dev/settings
---

--- 2024-05-03T12:38:19.831Z debug
HEADERS: {
  "User-Agent": "wrangler/3.53.1"
}
---

--- 2024-05-03T12:38:19.831Z debug
INIT: {}
---

--- 2024-05-03T12:38:19.831Z debug
-- END CF API REQUEST
---

--- 2024-05-03T12:38:20.778Z debug
-- START CF API RESPONSE: OK 200
---

--- 2024-05-03T12:38:20.779Z debug
HEADERS: {
 ...
}
---

--- 2024-05-03T12:38:20.779Z debug
RESPONSE: {
  "result": {
    "placement": {},
    "compatibility_date": "2024-04-05",
    "compatibility_flags": [
      "nodejs_compat"
    ],
    "usage_model": "standard",
    "tags": [],
    "tail_consumers": [],
    "logpush": true,
    "bindings": [
      {
        "class_name": "DurableObjectNamespace",
        "name": "DO",
        "namespace_id": "{do_id}",
        "script_name": "do-script-name-dev",
        "type": "durable_object_namespace"
      },
      {
        "name": "RANDOM_SECRET",
        "type": "secret_text"
      },
    ]
  },
  "success": true,
  "errors": [],
  "messages": []
}

---

--- 2024-05-03T12:38:20.779Z debug
-- END CF API RESPONSE
---

--- 2024-05-03T12:38:20.779Z debug
-- START CF API REQUEST: PATCH https://api.cloudflare.com/client/v4/accounts/{accountId}/workers/scripts/worker-name-dev/settings
---

--- 2024-05-03T12:38:20.779Z debug
HEADERS: {
  "User-Agent": "wrangler/3.53.1"
}
---

--- 2024-05-03T12:38:20.779Z debug
INIT: {
  "method": "PATCH",
  "body": {}
}
---

--- 2024-05-03T12:38:20.779Z debug
-- END CF API REQUEST
---

--- 2024-05-03T12:38:21.793Z debug
-- START CF API RESPONSE: Bad Request 400
---

--- 2024-05-03T12:38:21.794Z debug
HEADERS: {
  ...
}
---

--- 2024-05-03T12:38:21.794Z debug
RESPONSE: {
  "result": null,
  "success": false,
  "errors": [
    {
      "code": 10061,
      "message": "Cannot create binding for class DurableObject that is not exported by the script"
    }
  ],
  "messages": []
}

---

--- 2024-05-03T12:38:21.794Z debug
-- END CF API RESPONSE
---

--- 2024-05-03T12:38:21.794Z log

---

--- 2024-05-03T12:38:21.794Z log
Finished processing secrets JSON file:
---

--- 2024-05-03T12:38:21.794Z log
✨ 0 secrets successfully uploaded
---

--- 2024-05-03T12:38:21.795Z log

---

--- 2024-05-03T12:38:21.879Z error
�[31m✘ �[41;31m[�[41;97mERROR�[41;31m]�[0m �[1m🚨 9 secrets failed to upload�[0m


---

--- 2024-05-03T12:38:21.880Z log
�[32mIf you think this is a bug then please create an issue at https://github.com/cloudflare/workers-sdk/issues/new/choose�[0m
---
@izidormaklary izidormaklary added the bug Something that isn't working label May 3, 2024
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
Projects
Status: Untriaged
Development

No branches or pull requests

1 participant