akopulko / ffiiitc

FireFly III Transactions Classifier
MIT License
37 stars 10 forks source link

404 when triggering webhook #10

Closed avephill closed 1 year ago

avephill commented 1 year ago

I've double and triple-checked that I have the right setup, but every time I trigger the webhook I receive:

Client error: `POST http://fftc:8080` resulted in a `404 Not Found` response:
404 page not found

#0 /var/www/html/vendor/guzzlehttp/guzzle/src/Middleware.php(72): GuzzleHttp\Exception\RequestException::create()
#1 /var/www/html/vendor/guzzlehttp/promises/src/Promise.php(209): GuzzleHttp\Middleware::GuzzleHttp\{closure}()
#2 /var/www/html/vendor/guzzlehttp/promises/src/Promise.php(158): GuzzleHttp\Promise\Promise::callHandler()
#3 /var/www/html/vendor/guzzlehttp/promises/src/TaskQueue.php(52): GuzzleHttp\Promise\Promise::GuzzleHttp\Promise\{closure}()
#4 /var/www/html/vendor/guzzlehttp/promises/src/Promise.php(251): GuzzleHttp\Promise\TaskQueue->run()
#5 /var/www/html/vendor/guzzlehttp/promises/src/Promise.php(227): GuzzleHttp\Promise\Promise->invokeWaitFn()
#6 /var/www/html/vendor/guzzlehttp/promises/src/Promise.php(272): GuzzleHttp\Promise\Promise->waitIfPending()
#7 /var/www/html/vendor/guzzlehttp/promises/src/Promise.php(229): GuzzleHttp\Promise\Promise->invokeWaitList()
#8 /var/www/html/vendor/guzzlehttp/promises/src/Promise.php(69): GuzzleHttp\Promise\Promise->waitIfPending()
#9 /var/www/html/vendor/guzzlehttp/guzzle/src/Client.php(189): GuzzleHttp\Promise\Promise->wait()
#10 /var/www/html/app/Services/Webhook/StandardWebhookSender.php(112): GuzzleHttp\Client->request()
#11 /var/www/html/app/Jobs/SendWebhookMessage.php(69): FireflyIII\Services\Webhook\StandardWebhookSender->send()
#12 /var/www/html/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(36): FireflyIII\Jobs\SendWebhookMessage->handle()
#13 /var/www/html/vendor/laravel/framework/src/Illuminate/Container/Util.php(41): Illuminate\Container\BoundMethod::Illuminate\Container\{closure}()
#14 /var/www/html/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(93): Illuminate\Container\Util::unwrapIfClosure()
#15 /var/www/html/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(35): Illuminate\Container\BoundMethod::callBoundMethod()
#16 /var/www/html/vendor/laravel/framework/src/Illuminate/Container/Container.php(662): Illuminate\Container\BoundMethod::call()
#17 /var/www/html/vendor/laravel/framework/src/Illuminate/Bus/Dispatcher.php(128): Illuminate\Container\Container->call()
#18 /var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(141): Illuminate\Bus\Dispatcher->Illuminate\Bus\{closure}()
#19 /var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(116): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()
#20 /var/www/html/vendor/laravel/framework/src/Illuminate/Bus/Dispatcher.php(132): Illuminate\Pipeline\Pipeline->then()
#21 /var/www/html/vendor/laravel/framework/src/Illuminate/Queue/CallQueuedHandler.php(123): Illuminate\Bus\Dispatcher->dispatchNow()
#22 /var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(141): Illuminate\Queue\CallQueuedHandler->Illuminate\Queue\{closure}()
#23 /var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(116): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()
#24 /var/www/html/vendor/laravel/framework/src/Illuminate/Queue/CallQueuedHandler.php(122): Illuminate\Pipeline\Pipeline->then()
#25 /var/www/html/vendor/laravel/framework/src/Illuminate/Queue/CallQueuedHandler.php(70): Illuminate\Queue\CallQueuedHandler->dispatchThroughMiddleware()
#26 /var/www/html/vendor/laravel/framework/src/Illuminate/Queue/Jobs/Job.php(98): Illuminate\Queue\CallQueuedHandler->call()
#27 /var/www/html/vendor/laravel/framework/src/Illuminate/Queue/SyncQueue.php(43): Illuminate\Queue\Jobs\Job->fire()
#28 /var/www/html/vendor/laravel/framework/src/Illuminate/Bus/Dispatcher.php(253): Illuminate\Queue\SyncQueue->push()
#29 /var/www/html/vendor/laravel/framework/src/Illuminate/Bus/Dispatcher.php(229): Illuminate\Bus\Dispatcher->pushCommandToQueue()
#30 /var/www/html/vendor/laravel/framework/src/Illuminate/Bus/Dispatcher.php(95): Illuminate\Bus\Dispatcher->dispatchToQueue()
#31 /var/www/html/vendor/laravel/framework/src/Illuminate/Bus/Dispatcher.php(266): Illuminate\Bus\Dispatcher->dispatchSync()
#32 /var/www/html/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(36): Illuminate\Bus\Dispatcher->Illuminate\Bus\{closure}()
#33 /var/www/html/vendor/laravel/framework/src/Illuminate/Container/Util.php(41): Illuminate\Container\BoundMethod::Illuminate\Container\{closure}()
#34 /var/www/html/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(81): Illuminate\Container\Util::unwrapIfClosure()
#35 /var/www/html/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(35): Illuminate\Container\BoundMethod::callBoundMethod()
#36 /var/www/html/vendor/laravel/framework/src/Illuminate/Container/Container.php(662): Illuminate\Container\BoundMethod::call()
#37 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(1272): Illuminate\Container\Container->call()
#38 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(215): Illuminate\Foundation\Application->terminate()
#39 /var/www/html/public/index.php(78): Illuminate\Foundation\Http\Kernel->terminate()
#40 {main}

The model trained on my transactions, apparently. And when I trigger the webhook I see ffiiitc | 2023/11/03 20:31:05 192.168.16.3:45130 POST / while running docker-compose logs -f fftc, so it's triggering something.

I'm running it in a docker-compose.yaml which looks like:

networks:
  firefly_iii:
    driver: bridge

firefly:
    image: fireflyiii/core:latest
    hostname: firefly
    restart: unless-stopped
    env_file: ./firefly/.env
    networks:
      - firefly_iii
    ports:
      - 4923:8080
    depends_on:
      - firefly-db

fftc:
    image: ffiiitc:latest
    hostname: fftc
    networks:
      - firefly_iii
    restart: unless-stopped
    container_name: ffiiitc
    environment:
      - FF_API_KEY=<SECRET>
      - FF_APP_URL=http://firefly:8080
    volumes:
      - ./firefly/ffiiitc:/app/data
    ports:
     - '8082:8080'
    depends_on:
     - firefly

And finally, this is what my webhook config looks like in firefly: 2023-11-03_2596x575

avephill commented 1 year ago

Also forgot to mention that this is an incredibly useful service and I'd really like to get it to work. I fully understand that it's likely my fault that I'm getting a 404. Thanks for all you do!

Jack-XHP commented 1 year ago

you need to use http://fftc:8080/classify as the webhook address. but I am still trying to fix following issue where classify result request back to firefly got a 404 error.

Jack-XHP commented 1 year ago

also you can also add webhook to update the classifier using http://fftc:8080/learn

akopulko commented 1 year ago

also you can also add webhook to update the classifier using http://fftc:8080/learn

please do not use this feature for now as I'm investigating some weird behaviour with that hook. It gets triggered even when /classify hook is called.

avephill commented 1 year ago

Thank you @Jack-XHP ! Adding /classify solved it. Thanks for adding it to the readme as well. Thanks for a really helpful service