v2.0.4: Fix webhook error handling and logging
All checks were successful
Build and Push Docker Image / build-and-push (push) Successful in 41s

- Webhooks now return 200 OK even on errors (to prevent retries)
- Improved error handling with proper JSON responses
- Enhanced logging for webhook debugging
- Supervisor logs now visible in docker logs (stdout/stderr)
- Fixed TodoistIntegration error display in UI
This commit is contained in:
poignatov
2026-01-01 18:50:55 +03:00
parent 7704de334c
commit edc29fbd97
5 changed files with 140 additions and 22 deletions

View File

@@ -1,6 +1,6 @@
{
"name": "play-life-web",
"version": "2.0.3",
"version": "2.0.4",
"type": "module",
"scripts": {
"dev": "vite",

View File

@@ -7,6 +7,7 @@ function TodoistIntegration({ onBack }) {
const [webhookURL, setWebhookURL] = useState('')
const [loading, setLoading] = useState(true)
const [copied, setCopied] = useState(false)
const [error, setError] = useState('')
useEffect(() => {
fetchWebhookURL()
@@ -15,14 +16,21 @@ function TodoistIntegration({ onBack }) {
const fetchWebhookURL = async () => {
try {
setLoading(true)
setError('')
const response = await authFetch('/api/integrations/todoist/webhook-url')
if (!response.ok) {
throw new Error('Ошибка при загрузке URL webhook')
const errorData = await response.json().catch(() => ({}))
throw new Error(errorData.error || 'Ошибка при загрузке URL webhook')
}
const data = await response.json()
setWebhookURL(data.webhook_url)
if (data.webhook_url) {
setWebhookURL(data.webhook_url)
} else {
throw new Error('Webhook URL не найден в ответе')
}
} catch (error) {
console.error('Error fetching webhook URL:', error)
setError(error.message || 'Не удалось загрузить webhook URL')
} finally {
setLoading(false)
}
@@ -50,6 +58,16 @@ function TodoistIntegration({ onBack }) {
<h2 className="text-lg font-semibold mb-4">Webhook URL</h2>
{loading ? (
<div className="text-gray-500">Загрузка...</div>
) : error ? (
<div className="text-red-600 mb-4">
<p className="mb-2">{error}</p>
<button
onClick={fetchWebhookURL}
className="px-4 py-2 bg-indigo-600 text-white rounded-lg hover:bg-indigo-700 transition-colors"
>
Попробовать снова
</button>
</div>
) : (
<div className="flex items-center gap-2">
<input