🐞 Troubleshooting Guide
This guide helps you resolve common issues you might encounter when using GitHub Project PHP.
Table of Contents
- Webhook Issues
- Authentication Problems
- Template Errors
- Common Error Messages
- Debugging Tips
- Getting Help
Webhook Issues
Webhook Not Triggering
Symptoms:
- No comments are being created when project items are updated
- No webhook deliveries in GitHub's webhook settings
Solutions:
- Check if the webhook is active in GitHub settings
- Verify the webhook URL is correct and accessible from the internet
- Check your server's error logs for any issues
- Ensure the webhook secret matches in both GitHub and your
.env
file
404 Not Found on Webhook Endpoint
Symptoms:
- GitHub reports 404 errors when delivering webhook events
Solutions:
- Verify the webhook URL is correct (check for typos)
- Ensure your application is running and accessible
- Check your web server configuration (Apache/Nginx) for proper routing
- Verify the route prefix in your config matches the URL
Authentication Problems
401 Unauthorized Errors
Symptoms:
- API requests to GitHub are failing with 401 errors
- Comments are not being posted
Solutions:
- Verify your GitHub access token is valid and has the required scopes:
repo
for repository projectsproject
for organization projectswrite:discussion
for discussions
- Check if the token has expired (they typically expire after a year)
- Regenerate the token if needed
403 Forbidden Errors
Symptoms:
- API requests return 403 Forbidden
- Webhook deliveries fail with 403
Solutions:
- Check if your GitHub token has sufficient permissions
- Verify the repository/org settings allow the token's access level
- For organization projects, ensure the token has organization access
Template Errors
Template Not Found
Symptoms:
- Errors about missing template files
- Comments not being generated for certain field types
Solutions:
- Verify the template files exist in
resources/views/vendor/github-project/md/field_types/
- Run
php artisan vendor:publish --provider="CSlant\GitHubProject\GithubProjectServiceProvider" --tag="views"
to publish templates - Check for typos in template filenames
Template Syntax Errors
Symptoms:
- Errors when rendering comments
- Malformed comment output
Solutions:
- Check your template files for syntax errors
- Ensure all Blade directives are properly closed
- Verify all variables used in templates exist in the template data
Common Error Messages
"Missing required field in payload"
Cause: The webhook payload is missing required fields.
Solution: Check that you've subscribed to the correct events in GitHub webhook settings.
"Field type not supported"
Cause: The package encountered a field type it doesn't have a template for.
Solution: Create a custom template for the field type in resources/views/vendor/github-project/md/field_types/
.
Debugging Tips
Enable Debug Mode
Add these to your .env
file for more detailed error messages:
APP_DEBUG=true
APP_ENV=local
Check Laravel Logs
View the Laravel logs for detailed error information:
tail -f storage/logs/laravel.log
Test Webhook Locally
Use a tool like ngrok to test webhooks on your local development environment:
ngrok http 8000
Then update your GitHub webhook URL to point to your ngrok URL.
Getting Help
If you're still experiencing issues:
- Check the GitHub Issues for similar problems
- Open a new issue with:
- A clear description of the problem
- Steps to reproduce
- Error messages from logs
- Your configuration (without sensitive information)
Common Questions
How do I know if my webhook is working?
- Go to your repository/organization settings
- Navigate to "Webhooks"
- Find your webhook and click on it
- Check the "Recent Deliveries" section for recent events
How can I test my templates without triggering GitHub events?
You can use the tinker
console to manually test template rendering:
// In tinker
$payload = [/* your test payload */];
app(\CSlant\GitHubProject\Services\GithubService::class)->generateCommentMessage($payload);
How do I update the package?
composer update cslant/github-project-php
php artisan vendor:publish --provider="CSlant\GitHubProject\GithubProjectServiceProvider" --tag="views" --force