Queue workers without an agent
Capture jobs and scheduled commands from Laravel Cloud's managed queue, Vapor and other places where the Nightwatch agent can't run.
The Nightwatch package hands each event to an agent on 127.0.0.1:2407. Where nothing listens on that port, it drops the events. This happens on Laravel Cloud's managed queue, on Vapor, and on any worker server without php artisan nightwatch:agent.
You can tell from the Jobs page. Jobs dispatched from web requests show up as queued, because the web servers have an agent, but no attempts arrive. Raccoon shows the warning "Jobs are queued, but no attempts arrive".
The raccoonwatch/laravel package fixes this. A queue worker or scheduled command that finds no agent sends its events to Raccoon over HTTPS after each job or command. Processes that have an agent keep using it.
Install#
composer require raccoonwatch/laravel
It reads the variables you already set for the agent, so there's nothing else to configure:
NIGHTWATCH_TOKEN=<environment token>
NIGHTWATCH_BASE_URL=https://raccoon.watch
Deploy, and job attempts show up on the Jobs page.
How it decides#
RACCOON_INGEST picks how events are sent:
| Value | Behavior |
|---|---|
auto (default) |
Queue workers and scheduled commands check for an agent on NIGHTWATCH_INGEST_URI (default 127.0.0.1:2407) when they start. If none answers, they send over HTTPS. Web requests always use the agent. |
http |
Always HTTPS, web requests included. Use it where web requests also run without an agent, as on Vapor. |
agent |
The package does nothing. |
What it costs a job#
Each job's events go out in one gzipped request after the job finishes, so the job's recorded duration doesn't include it. Each worker signs in with NIGHTWATCH_TOKEN and keeps the short-lived ingest token in your default cache store.
If Raccoon doesn't answer within RACCOON_INGEST_TIMEOUT seconds (default 3), that batch is dropped and Nightwatch's error handler gets the exception. The job itself isn't affected.
To change these settings in a config file, publish it:
php artisan vendor:publish --tag=raccoon-config
Requirements#
PHP 8.2 or later, Laravel 11 to 13, and laravel/nightwatch 1.30 or later. The package replaces Nightwatch's transport through an interface that Nightwatch marks as internal, so check that job attempts still arrive after you upgrade laravel/nightwatch.