Uncaught ErrorClass ErrorClass in discord.js - discord

My bot was working fine. Using a slash command /close the bot saved the messages of a channel in hastebin and deleted the channel. I added another command to update roles, it works fine but after using it one time the "close" command doesn't work anymore, even if I remove the "update permissions" command from the command's folder.
I figured out the problem is in the "close" command, in particular when I fetch the channel messages. If I don't fetch the messages I don't get any error, but leaving it as it was causes the error below. Once again, the command was working fine before adding and using the "update permissions" . I googled this error but I can't find anything about it. I don't know if u need the code, the problem is just in the fetch messages step. I tried over and over again, and I don't get why it doesn't work anymore.
chan.messages.fetch().then(async (messages) => {
Uncaught ErrorClass ErrorClass
at processPromiseRejections (internal/process/promises:288:13)
at processTicksAndRejections (internal/process/task_queues:96:32)

Related

How do I resolve the 50001-Error "Missing Access" when trying to register commands for my bot?

I am having some trouble with the registration of commands for my Discord bot.
I am following the tutorial on discordjs.guide, but get an error, where they dont. When I try to run their code, I get an error in the console related to missing access of the bot. I am aware that "applications.commands" needs to be checked in the discord developer portal and that the bot needs to be kicked and re-added to the server, but despite doing all that, the error still remains.
The error looks like this:
DiscordAPIError[50001]: Missing Access
at SequentialHandler.runRequest (<my-folder-path>\node_modules\#discordjs\rest\dist\index.js:753:15)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async SequentialHandler.queueRequest (<my-folder-path>\node_modules\#discordjs\rest\dist\index.js:565:14)
at async REST.request (<my-folder-path>\node_modules\#discordjs\rest\dist\index.js:999:22) {
rawError: { message: 'Missing Access', code: 50001 },
code: 50001,
status: 403,
method: 'PUT',
url: 'https://discord.com/api/v9/applications/<my-bot-id>/guilds/<my-guild-id>/commands',
requestBody: { files: undefined, json: [ [Object], [Object], [Object] ] }
}
I have replaced a few irrelevant parts in the message like Ids and folder paths with general statements at "< >" due to privacy reasons.
On thing that differs from the error-message of some other folks with the same problem, is that there is no line in their message stating the request-body like there is in the last line of mine.
The issue could be resolved by adding the "application.commands" permission in the bot settings, but as stated earlier, this didnt work for me. In terms of code, I am using the exact code as in the example, with my specific data filled into the config.json.
My bot has the scopes of "bot" and "application.commands", as well as the bot permissions of "Administrator".
I am very thankful for every response!
Check if the applications.commands scope is checked in the developers portal OAuth2 section.

React-app deployment to Github Pages - Build Successful but deploy failed

Initially, I deployed my React app (created with create-react-app) to Github Pages and it works fine. However, after a few changes to the src files, I wanted to update the website so I decided to re-deploy the app using npm run deploy and it finishes with Published being printed at the end of the command. On Github, the actions shows that the build is successful, but it's not able to deploy, giving me an error code of 400.
Complete error log from Github is as follow:
Actor: github-pages[bot]
Action ID: 1996792679
Artifact URL: https://pipelines.actions.githubusercontent.com/P4vIRQYdOzrk38NoGmJNrF5GvwW7S92VAUyJNinMXyLtZzPbIB/_apis/pipelines/workflows/1996792679/artifacts?api-version=6.0-preview
{"count":1,"value":[{"containerId":354579,"size":3092480,"signedContent":null,"fileContainerResourceUrl":"https://pipelines.actions.githubusercontent.com/P4vIRQYdOzrk38NoGmJNrF5GvwW7S92VAUyJNinMXyLtZzPbIB/_apis/resources/Containers/354579","type":"actions_storage","name":"github-pages","url":"https://pipelines.actions.githubusercontent.com/P4vIRQYdOzrk38NoGmJNrF5GvwW7S92VAUyJNinMXyLtZzPbIB/_apis/pipelines/1/runs/2/artifacts?artifactName=github-pages","expiresOn":"2022-06-15T05:21:40.7473658Z","items":null}]}
Creating deployment with payload:
{
"artifact_url": "https://pipelines.actions.githubusercontent.com/P4vIRQYdOzrk38NoGmJNrF5GvwW7S92VAUyJNinMXyLtZzPbIB/_apis/pipelines/1/runs/2/artifacts?artifactName=github-pages&%24expand=SignedContent",
"pages_build_version": "8e6a4594c3e946a3f32ab67af68f527ec66ffc90",
"oidc_token": "***"
}
Failed to create deployment for 8e6a4594c3e946a3f32ab67af68f527ec66ffc90.
{"message":"Deployment request failed for 8e6a4594c3e946a3f32ab67af68f527ec66ffc90 due to in progress deployment. Please cancel c1852e5059b99567d48405d0610990fdc25f0946 first or wait for it to complete.","documentation_url":"https://docs.github.com/rest/reference/repos#create-a-github-pages-deployment"}
Error: Error: Request failed with status code 400
Error: Error: Request failed with status code 400
Sending telemetry for run id 1996792679
I'm very confused with what the error is, has anyone countered a 400 error code before while deploying to Gh Pages?
Additional Note: If you need any additional information, please do comment below as this is my first time deploying react app to github pages so I would love to help you in helping me
UPDATE
You can visit the github repo here: cynclar.github.io
I haven't found a solution, but I have a workaround. If you go to the last working workflow run in the Actions tab (look for a green checkmark), you can click Re-run all jobs, which should deploy your webpage for you, including the latest changes.
Hope this works for the time being until there is a better solution!
GitHub has fixed the issue:
If you navigate to the Actions tab, find the last deployment, and Re-run all jobs, it should work. I have tried this myself and it has been successful!
I'll leave the last answer up in case this doesn't work for anyone.
I had the same issue and this didn't work, re-running the old deploy used the same code and didn't have my changes. I deleted all the workflows from the github Actions tab and then pushing again triggered a new deployment that worked.

React/Github-pages: Failed to load resource: the server responded with a status of 404 ()

I have successfully uploaded react app`s to github pages before, but this time when I try to upload a new page the code is pushed and everything looks fine in the repository, everything loads fine in the localhost. The problem is when I access the website in the console i get the error message above.
const res = await axios.get(' https://api.open5e.com/monsters/?limit=1086');
I am using this API, the limit is above 50 but I don`t believe this is the reason for the crash but I cannot think of anything else.
Website 1: (Currently redirects you to a 404 error page, as part of my attempt to solve the problem)
https://ottotsuma.github.io/MonsterSearch/
Repo - Website 1:
https://github.com/ottotsuma/MonsterSearch
Website 2:
https://ottotsuma.github.io/MonsterApiReact/
Repo all code:
https://github.com/ottotsuma/DnD-React
I also get this error in localhost and the hosted website: Uncaught TypeError: Cannot use 'in' operator to search for 'default' in undefined. But since the website was working as intended so far I have just ignored it.
I was hoping if anyone else has had a similar problem with gh-pages they might know what I have done wrong.
Kind regards,
Sheep

Server up and running but webpage not rendering on heroku local

I am in the process of deploying a dynamic, React.js app to Heroku and wanted to test it out by using 'heroku local' to see if it works before pushing it to Heroku. Everything seemed to be working fine with the server - my database console.log message logs to the terminal signifying everything is going well - but when I try to access the website which is on localhost:5000, I get an error message of 'Cannot GET /' and the console prints a message saying , 'Failed to load resource: the server responded with a status of 404 (Not Found)'. My React.js files are all within the build folder which in conjunction with all of the other files, were pushed to git and commited, but for some reason my files are not showing up. I would greatly appreciate if someone could help me determine what went wrong. Sorry if my question is a little vague; please let me know if I can clarify something in better detail as I am fairly new to programming.
I've added a proxy to one of my package.json files to help with url routing; possibly this could be causing the issue?
Also, if it helps at all, a photo of my folders within Visual Studio code are listed below:

enable tilestache logging

I'm trying to get TileStache to generate some tiles but it is not making the call to the url template that I've specified. The TS docs say that I can enable logging in the config file by adding "logging": "debug". I've done so, but am not seeing any sort of logging anywhere. Any suggestions?
You can see the errors that are generated throught the web server log. if you are using apache wsgi, you can see then in the apache error log file. If you are using Werkzeug wsgi, you can see the errors that are generated throuth the console. Sometimes it helps to watch the responce to the request from firebug.
Most of the time the error is due to a missing dependency or in the wrong url template.

Resources