Skip to main content
Best answer

Discord "Add role" action used to work, now throws error: Failed to create a role in Discord


Hi,

 

I had a Zap set-up that would find a user using the “Find User in Discord” action, and then assign a role to this user. The Zap used to work perfectly, until March 6th it stopped working - while nothing had been changed on my part.

I looked into it and saw the following error being thrown:

 

Failed to create a role in Discord
Class constructor AppError cannot be invoked without 'new'

 

I proceeded to test to narrow down the problem, by

  • Assigning a different role
  • Assigning the role to a different hardcoded user value instead of ID through Find User
  • Testing the Add role action as barebones as possible in a new Zap: using a fresh server, fresh role, and to a different user, both hardcoded and through Find User.

All attempts resulted in the same error.

After some googling I found this Reddit post (https://www.reddit.com/r/zapier/comments/1b7u2bz/discord_api_in_zapier/) of a set of other users experiencing the same error, happening from around the same time (March 6th onward).

My educated guess is that something is awry on the side of the Discord Zapier integration itself (or more specifically, the Add Role action) - rather than in my own implementation. But maybe I’m overlooking something.

I contacted Discord but they said this was out of their scope and asked me to contact Zapier instead. So here we are.

Can anyone provide some help with this?

Thanks in advance,

Philip

Best answer by ken.aBest answer by ken.a

Hi there @flip.vanwijk,

Welcome to the Community! 🎉

I have a hunch this issue might be a permission issue with Discord. This happens when the Zapier bot's own role is too low. Bots cannot assign users to roles higher than the bot, itself. The bot's role needs to be higher than the role it's assigning.

Discord determines role priority by its physical place in the "Roles" list, and users can drag-and-drop to rearrange roles. Moving Zapier's role higher than the role it's assigning should resolve the issue.

Kindly give it a try and let me know how it goes? I'll keep an eye out for your response!

View original
Did this topic help you find an answer to your question?

14 replies

  • Author
  • Beginner
  • 2 replies
  • March 18, 2024

Here’s some screenshots of the Add role action config (user ID and role name redacted for privacy reasons)

 


ken.a
Forum|alt.badge.img+6
  • Zapier Staff
  • 6388 replies
  • Answer
  • March 19, 2024

Hi there @flip.vanwijk,

Welcome to the Community! 🎉

I have a hunch this issue might be a permission issue with Discord. This happens when the Zapier bot's own role is too low. Bots cannot assign users to roles higher than the bot, itself. The bot's role needs to be higher than the role it's assigning.

Discord determines role priority by its physical place in the "Roles" list, and users can drag-and-drop to rearrange roles. Moving Zapier's role higher than the role it's assigning should resolve the issue.

Kindly give it a try and let me know how it goes? I'll keep an eye out for your response!


  • Beginner
  • 2 replies
  • March 20, 2024

It totally worked - thanks a bunch @ken.a :)


  • Author
  • Beginner
  • 2 replies
  • March 20, 2024

Hi Ken,

 

Thanks for the swift response! Your hunch was totally correct, moving the role up the order resolved the issue.

 

Strange and unclear feature on Discord’s side, one would assume a role with admin rights would just be able to assign any role...

Thanks a ton for the insight! Got everything working now.

 

Kind regards,

Philip


ken.a
Forum|alt.badge.img+6
  • Zapier Staff
  • 6388 replies
  • March 21, 2024

Hi @flip.vanwijk and @husayngokal,

You are most welcome! I’m glad I was able to help!

If you have any other questions, please don’t hesitate to reach out to the Community. We’re always happy to help! 🤗


Forum|alt.badge.img
  • Beginner
  • 11 replies
  • March 22, 2024

I followed these steps and still the same error. What now?


Forum|alt.badge.img
  • Beginner
  • 11 replies
  • March 23, 2024
ken.a wrote:

Hi @flip.vanwijk and @husayngokal,

You are most welcome! I’m glad I was able to help!

If you have any other questions, please don’t hesitate to reach out to the Community. We’re always happy to help! 🤗

I followed these steps and still the same error. What now?


ken.a
Forum|alt.badge.img+6
  • Zapier Staff
  • 6388 replies
  • March 27, 2024

Hi @thereverend,

Thanks for letting me know.

Could you please try reconnecting your Discord account here: https://zapier.com/app/connections/discord. Additionally, could you please send a screenshot of your Roles in Discord?

Thanks!


Hey @ken.a ,

 

For some reason, even after re-connecting - I can’t get the zap to work. It still give me the same error and the role is the highest in my roles overview.

 

What other information would you need?


ken.a
Forum|alt.badge.img+6
  • Zapier Staff
  • 6388 replies
  • April 9, 2024

Hi @Jasper.mittelmeijer,

The Roles on your Discord should be correct here. However, you mentioned that you’re still getting the error. Would you mind sharing a screenshot of the “Action” section of your Discord action step that shows all of its fields? Like so:

46dd6c0979e3d815d621b8da43084ef1.png
(view larger)

Please don't include personal information in the screenshot, or be sure blur out any personal information.

Thanks!


  • New
  • 3 replies
  • July 9, 2024
ken.a wrote:

Hi @Jasper.mittelmeijer,

The Roles on your Discord should be correct here. However, you mentioned that you’re still getting the error. Would you mind sharing a screenshot of the “Action” section of your Discord action step that shows all of its fields? Like so:

46dd6c0979e3d815d621b8da43084ef1.png
(view larger)

Please don't include personal information in the screenshot, or be sure blur out any personal information.

Thanks!

Hey @ken.a ! I am the one running into this issue now. Are you able to help me please?


ken.a
Forum|alt.badge.img+6
  • Zapier Staff
  • 6388 replies
  • July 10, 2024

Hi @BBFFMikey,

Could you please share the “Action” section of your Discord step? Please ensure that you capture all of its fields.

Thanks!


  • New
  • 3 replies
  • July 11, 2024
ken.a wrote:

Hi @BBFFMikey,

Could you please share the “Action” section of your Discord step? Please ensure that you capture all of its fields.

Thanks!

Sure! Attached! 


ken.a
Forum|alt.badge.img+6
  • Zapier Staff
  • 6388 replies
  • July 12, 2024

Hi @BBFFMikey,

Thanks for the screenshot!

The "User" field in the "Add Role" action step requires the User ID from Discord. If the user already exists in Discord, I suggest using a "Find User" step. However, the "Find User" step looks for the username of the Discord user.

8af925808a6e2d0b9566043a5dd9145b.png
(view larger)

To do this, you should store the usernames of all your users in a Google Sheet spreadsheet along with their email addresses and utilize the Google Sheet lookup workaround. You can find more information about this here:

Hopefully, this helps!