- Add console.log statements that will ALWAYS appear if hooks are called - Trace WorkflowExecutor creation and method availability - Log every step of hook execution pipeline - This will help identify exactly where the execution is failing 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
3.9 KiB
🚨 Critical Update: PayloadCMS Automation Plugin v0.0.16
⚡ Immediate Action Required
A critical bug has been identified and fixed in v0.0.15 that prevented workflows from executing in development environments. Please update immediately to resolve workflow execution issues.
🔧 Quick Update Steps
1. Update the Package
npm update @xtr-dev/payload-automation
# OR
yarn upgrade @xtr-dev/payload-automation
# OR
pnpm update @xtr-dev/payload-automation
2. Verify Version
Check that you're now on v0.0.16:
npm list @xtr-dev/payload-automation
3. Restart Your Development Server
# Stop your current dev server (Ctrl+C)
# Then restart
npm run dev
# OR
yarn dev
# OR
pnpm dev
4. Test Your Workflows
Your workflows should now execute properly! Look for these log messages:
[payload-automation] Plugin initialized successfully - all hooks registered
AUTOMATION PLUGIN: Collection hook triggered
executeTriggeredWorkflows called
Found workflows to check
🐛 What Was Fixed
Critical Bug: Hook Registration Failure
- Problem: The
hooksInitializedflag prevented proper hook registration in development mode - Symptom: Workflows would not execute even when correctly configured
- Fix: Removed the problematic flag, ensuring hooks register on every initialization
Enhanced Debugging
- Added: Comprehensive logging with "AUTOMATION PLUGIN:" prefix
- Added: Try/catch blocks to prevent silent failures
- Added: Better error messages and stack traces
🔍 Troubleshooting
If workflows still don't execute after updating:
-
Check your workflow configuration (should now use v0.0.15+ schema):
// ✅ Correct v0.0.15+ schema { triggers: [{ type: 'collection-trigger', collectionSlug: 'orders', operation: 'update', condition: '$.trigger.doc.status == "Paid"' // JSONPath format }], steps: [{ step: 'uppercaseText', // 'step' not 'type' name: 'Process Order', input: { // 'input' not 'inputs' inputText: '$.trigger.doc.orderName has been paid!' } }] } -
Verify plugin configuration includes your collections:
automationPlugin({ collections: ['orders', 'users', 'products'], // Must include target collections // ... other config }) -
Check the logs for "AUTOMATION PLUGIN:" messages during hook execution
-
Ensure workflow status: If using versioning, make sure workflows are "Published" not "Draft"
📋 Schema Changes Recap (from v0.0.14 → v0.0.15+)
If you haven't updated your workflows since v0.0.14, you'll also need to update the schema:
Triggers
// ❌ OLD v0.0.14
conditions: [
{ field: 'status', operator: 'equals', value: 'Paid' }
]
// ✅ NEW v0.0.15+
condition: '$.trigger.doc.status == "Paid"'
Steps
// ❌ OLD v0.0.14
{
type: 'uppercaseText',
inputs: { inputText: 'Hello' }
}
// ✅ NEW v0.0.15+
{
step: 'uppercaseText',
input: { inputText: 'Hello' }
}
🆘 Support
If you're still experiencing issues after updating to v0.0.16:
- Check console logs for "AUTOMATION PLUGIN:" messages
- Verify your workflow schema matches v0.0.15+ format
- Confirm plugin configuration includes target collections
- File an issue at https://github.com/anthropics/claude-code/issues with:
- PayloadCMS version
- Complete console logs during workflow execution
- Your workflow configuration (sanitized)
✅ Success Indicators
After updating, you should see:
- ✅ Workflow runs created in
workflow-runscollection - ✅ "AUTOMATION PLUGIN:" log messages during hook execution
- ✅ Jobs appearing in
payload-jobscollection - ✅ Workflow steps executing successfully
This is a critical bug fix release - no breaking changes, just fixes the core functionality that wasn't working in v0.0.15.