llegomark / url-shortener

A simple and efficient URL shortener built with Cloudflare Workers, Hono, and TypeScript.
https://github.com/llegomark/url-shortener-frontend
MIT License
2 stars 0 forks source link

Q&A #3

Open WuChenDi opened 1 month ago

WuChenDi commented 1 month ago

Hi, I would like to inquire about some issues with this project.

First, there are a few points that need updating:

station :: wudi/short-url/url-shortener ‹main*› » npx wrangler kv:put --namespace-id=96d5d9b6xxxxc1cfc7e726ab3e27d56d49ddf1f2b29e79f77bda4ad7b3f86a8b "my-api-key" "true"                                                                                                                   127 ↵

✘ [ERROR] Unknown arguments: namespace-id, namespaceId, kv:put, my-api-key, true

wrangler

COMMANDS
  wrangler docs [command]            📚 Open Wrangler's command documentation in your browser

  wrangler init [name]               📥 Initialize a basic Worker
  wrangler dev [script]              👂 Start a local server for developing your Worker
  wrangler deploy [script]           🆙 Deploy a Worker to Cloudflare  [aliases: publish]
  wrangler deployments               🚢 List and view the current and past deployments for your Worker [open beta]
  wrangler rollback [deployment-id]  🔙 Rollback a deployment for a Worker [open beta]
  wrangler delete [script]           🗑  Delete a Worker from Cloudflare
  wrangler tail [worker]             🦚 Start a log tailing session for a Worker
  wrangler secret                    🤫 Generate a secret that can be referenced in a Worker
  wrangler types [path]              📝 Generate types from bindings and module rules in configuration

  wrangler kv                        🗂️  Manage Workers KV Namespaces
  wrangler queues                    🇶  Manage Workers Queues
  wrangler r2                        📦 Manage R2 buckets & objects
  wrangler d1                        🗄  Manage Workers D1 databases
  wrangler vectorize                 🧮 Manage Vectorize indexes [open beta]
  wrangler hyperdrive                🚀 Manage Hyperdrive databases
  wrangler pages                     ⚡️ Configure Cloudflare Pages
  wrangler mtls-certificate          🪪  Manage certificates used for mTLS connections
  wrangler pubsub                    📮 Manage Pub/Sub brokers [private beta]
  wrangler dispatch-namespace        🏗️  Manage dispatch namespaces
  wrangler ai                        🤖 Manage AI models

  wrangler login                     🔓 Login to Cloudflare
  wrangler logout                    🚪 Logout from Cloudflare
  wrangler whoami                    🕵️  Retrieve your user information

GLOBAL FLAGS
  -j, --experimental-json-config  Experimental: support wrangler.json  [boolean]
  -c, --config                    Path to .toml configuration file  [string]
  -e, --env                       Environment to use for operations and .env files  [string]
  -h, --help                      Show help  [boolean]
  -v, --version                   Show version number  [boolean]

Please report any issues to https://github.com/cloudflare/workers-sdk/issues/new/choose
🪵  Logs were written to "/root/.config/.wrangler/logs/wrangler-2024-08-13_09-47-45_566.log"

The correct command should be:

# npx wrangler kv:key put --binding=API_KEYS "your-api-key" "true"

npx wrangler kv key put --binding=API_KEYS "your-api-key" "true"

However, from this point, a new issue has occurred. The process is stuck at a 401 error. Can you advise on the troubleshooting direction? What step might I have set incorrectly?

image

WuChenDi commented 4 weeks ago

I seem to have discovered that this issue only occurs in the local development environment. Upon updating to CF, everything appears to function normally.