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

Queueing support #6

Closed
zepfietje opened this issue Apr 14, 2021 · 13 comments
Closed

Queueing support #6

zepfietje opened this issue Apr 14, 2021 · 13 comments

Comments

@zepfietje
Copy link

It seems like this package currently doesn't support queued notifications?

@MSnoeren
Copy link
Member

MSnoeren commented Apr 14, 2021

Hi @zepfietje! It should support queueing. Does your notification implement Laravel's ShouldQueue and Queueable?

@zepfietje
Copy link
Author

Yes, and it works fine locally. However, running in production it fails with the following exception:
Driver [SnoerenDevelopment\DiscordWebhook\DiscordWebhookChannel] not supported.

@MSnoeren
Copy link
Member

MSnoeren commented Apr 14, 2021

Strange. That often means that namespaces are not correctly configured as Laravel cannot find them. Can you optimize your local environment and try again locally or clear the application cache in production? Maybe it's a caching issue.

@zepfietje
Copy link
Author

What do you mean by "optimize your local environment"?

@MSnoeren
Copy link
Member

The php artisan optimize and php artisan optimize:clear commands. They cache the autodiscovered packages too.

@zepfietje
Copy link
Author

After running php artisan optimize locally, no notifications come through. Both queued and not.

@MSnoeren
Copy link
Member

I verified it working locally both queued, unqueued, optimized and non-optimized. In all cases the notification was sent. Can you check if you;

  1. use DiscordWebhookChannel::class in your via method of your notification.
  2. Implement the toDiscord method in your notification.
  3. Implement the routeNotificationForDiscord method on your notifiable model (often User or Team).
  4. Have a working webhook URL for Discord.

If none of it works, I would try to dump the composer autoload files again to ensure the class is autoloaded. Also, some (example) code would help ;)

@zepfietje
Copy link
Author

It's working locally now (not sure what fixed it).
However, in production (or staging) I can't seem to get it to work.
Also tried running composer dump-autoload and php artisan optimize:clear there.

I'm not doing anything special with the notification, so probably it's not related to this package (but rather a caching issue indeed).

@zepfietje
Copy link
Author

When running php artisan package:discover I found that this package is not listed.
Could this be the cause?

@MSnoeren
Copy link
Member

The package should be autodiscovered. It was in my test setup. Are you using Laravel 5.5 or higher?

@zepfietje
Copy link
Author

Yep, latest Laravel version.

@MSnoeren MSnoeren closed this as completed May 2, 2021
@zepfietje
Copy link
Author

@MSnoeren I'm still running into this issue.
Everything works fine locally (queued and not queued), but in production it only works when not queueing the notification. When queuing, I get the exception I posted earlier:
Driver [SnoerenDevelopment\DiscordWebhook\DiscordWebhookChannel] not supported.

@zepfietje
Copy link
Author

Okay, finally solved it by running php artisan queue:restart.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants