akmolina28 / last-watch-ai

Self-hosted computer vision automation application
MIT License
64 stars 9 forks source link

Adding web request automation returns error #9

Closed depuits closed 3 years ago

depuits commented 3 years ago

When trying to add a web request automation I receive an error and so I can't add those automation. I've also tested the telegram automation and that one works.

request

{
  "name": "HA motion detected",
  "url": "https://hass.test.net/api/states/sensor.cctv_motion_detection",
  "is_post": true,
  "body_json": "{\n    \"state\": \"lwa\"\n}",
  "headers_json": "{\n    \"Authorization\": \"Bearer secret\",\n    \"Content-Type\": \"application/json\"\n}"
}

Response

{
    "message": "Server Error"
}
akmolina28 commented 3 years ago

I reproduced it and I think it's a permission problem. Can you try running these and see if it fixes?

cd /path/to/last-watch-ai
sudo chmod -R 775 src/storage
sudo chmod -R 775 src/bootstrap/cache
depuits commented 3 years ago

Tried changing the permissions but still the same result.

akmolina28 commented 3 years ago

I was able to reproduce the problem and it was because laravel was failing to open the log file for writes due to permissions. There was some debug logging left over that I forgot to remove. The log file is at src/storage/logs/laravel.log.

I ran the permissions above (the laravel documentation recommends running these anyways) and that fixed it for me. I also removed the debug logging in the latest commit.

It's clear to me that I still haven't quite figured out the optimal permission settings for different flavors of linux. I will do some more testing soon to figure this out.

depuits commented 3 years ago

Now I'm able to add web requests. I've updated the install and re-run the chmod.