Skip to content

Out of Date Information #8

@humor4fun

Description

@humor4fun

Hello!
Thanks for publishing this guide. It is exactly what I'm looking for (code on github, deploy to cloudflare worker, server-install discord bot with / commands).

I am very new to developing in this area though.

Issue 1
This ID is mentioned but its not clear where this comes from in the instructions before the step to put it into the secrets.
$ wrangler secret put DISCORD_TEST_GUILD_ID

Issue 2
Make sure to [install the Wrangler CLI](https://developers.cloudflare.com/workers/cli-wrangler/install-update/) and set it up.
This direction is very vague. What sort of setup is required? The installation page you mention just has the user run a single command npm install wrangler --save-dev. There's no instructions on setting it up. the Configuration page has more details, but its just documentation about the configuration file, not a guide for getting started with a basic configuration. What settings need to be set in the wrangler.jsonc file? Somewhere in here it should talk about connecting wrangler-cli to the cloudflare account. I did this accidentally by running wrangler init <botname> which walked me through connecting wrangler to my cloudflare account, but it also created a project and initialized it. I've now deleted all those files, but the worker still exists in my account.

Issue 3
Perhaps this is a quirk of using a windows platform, but wrangler is not installed natively using the standard Cloudflare guide. It requires npx wrangler ... to execute the commands

Issue 4
For the directions about Storing Secrets, where should this be run? I'm assuming to cd into the working directory where wrangler-cli was installed? If i just run npx wrangler secret put .... It gives an error and requires a --name <workername> to be included.

Issue 5
Running Locally should start off with git clone https://github.com/FnrDev/workers.git then cd workers before npm install

Issue 6
Environment variables in windows/powershell are set using $Env:DISCORD_APPLICATION_ID = "value" in case you want to reference that (use Write-Output $env:DISCORD_APPLICATION_ID to output the value, and Remove-Item Env:\DISCORD_APPLICATION_ID to delete it.

Issue 7
DISCORD_TEST_GUILD_ID is referenced in the register script but not exported anywhere. Is that needed? I couldn't get past this point to be honest. When running npm run dev this error just sits on screen.

⬣ Listening at http://localhost:8787
remote worker: ParseError: Received a bad response from the API
    at throwFetchError (T:\discord-bot\workers\node_modules\wrangler\wrangler-dist\cli.js:134740:17)
    at fetchResult (T:\discord-bot\workers\node_modules\wrangler\wrangler-dist\cli.js:134713:5)
    at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
    at async previewToken (T:\discord-bot\workers\node_modules\wrangler\wrangler-dist\cli.js:135607:29)
    at async createWorker (T:\discord-bot\workers\node_modules\wrangler\wrangler-dist\cli.js:135624:17)
    at async start (T:\discord-bot\workers\node_modules\wrangler\wrangler-dist\cli.js:137151:16) {
  text: 'Received a bad response from the API',
  notes: [
    {
      text: 'POST method not allowed for the oauth_token authentication scheme [code: 10000]'
    }
  ],
  location: undefined,
  kind: 'error',
  code: 10000
}

Thanks for your guide. Use these improvement notes if you like. I'm going to try to parse out what I can about how Cloudflare and discord stuff works and go from there. I don't really need a dev environment, but I would like to understand it before pushing the code straight into cloudflare.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions