keshavdv / unifi-cam-proxy

Enable non-Ubiquiti cameras to work with Unifi NVR
MIT License
1.59k stars 223 forks source link

Unable to load UniFi Protect page after starting container #372

Open rdamazio opened 1 month ago

rdamazio commented 1 month ago

Camera

Dahua IPC-HFW4431E-S

Firmware version of the camera

No response

Description

I tried using this container, and it seems to have "bricked" UniFi Protect on my console - I can no longer even load the main Protect page. (everything else in the console seems to still work).

How to reproduce

  1. Install UniFi Protect on a brand new UDM Pro Max
  2. Generate the certificate as documented
  3. Start the container with
    version: "3.9"
    services:
    garage-left:
    restart: unless-stopped
    image: keshavdv/unifi-cam-proxy
    volumes:
      - "/volume3/services/camera-proxy/client.pem:/client.pem"
    command: unifi-cam-proxy --host 192.168.200.1 --cert /client.pem --token REDACTED rtsp -s rtsp://synology:REDACTED@192.168.200.100:554/cam/realmonitor?channel=1&subtype=0'
  4. Open the UniFi Protect page on the UDM

Expected behaviour

The camera would be adopted, or show up for adoption, on the UniFi Protect page.

Screenshots

Adoption notification: Screenshot 2024-05-29 at 17 21 00

Error page: Screenshot 2024-05-29 at 17 21 26

Additional information

I've tried uninstalling and re-installing UniFi Protect, but still unable to load the page. Stopping the container also makes no difference. I tried digging through the Postgres database that UniFi Protect uses, but no cameras are listed there in the "cameras" table.

UniFi OS v3.2.17.

maochen commented 1 month ago

same here, seems like the token got messed up. So I tried these so far:

  1. mobile phone: protect app, it does work well.
  2. change the browser to private mode, login again (and use another url, like if you are using ui.com/xxx that has issue, then use local ip 192.168.1.1, vice versa)
Artentus commented 1 month ago

I'm having the same problem. My best guess is the recent update to Protect 4 broke compatibility.

The only thing I have found so far that "unbricks" Protect is to delete all browser local storage, data bases, cookies etc and then reinstall Protect on the UDM. There musn't be a single trace of the proxy cam left anywhere or it will re-brick itself immediately.

zzzbatmand commented 1 month ago

I'm having the same problem. My best guess is the recent update to Protect 4 broke compatibility.

The only thing I have found so far that "unbricks" Protect is to delete all browser local storage, data bases, cookies etc and then reinstall Protect on the UDM. There musn't be a single trace of the proxy cam left anywhere or it will re-brick itself immediately.

This works for un-bricking the UDM-Protect, but if you want unifi-cam-proxy to work then I found a temporary solution.

You can SSH into the UDM and download an older version of the Protect software. This isn't a great solution, but it works for now.

To downgrade just uninstall the Protect from the web gui. Then SSH into the UDM and run the following commands:

apt-get update

apt-get install --reinstall --allow-downgrades unifi-protect=3.0.26 -y

I use Protect 3.0.26 above as that seems to work. I havent tried other versions, but this seems like the lates official stable release before v4.

rdamazio commented 1 month ago

For just unbricking, I managed to do it by: uninstalling Protect, rebooting, then installing again. I guess some non-persistent state gets cleared during the reboot which makes it happy again.

demonjrules commented 4 weeks ago

This works for un-bricking the UDM-Protect, but if you want unifi-cam-proxy to work then I found a temporary solution.

You can SSH into the UDM and download an older version of the Protect software. This isn't a great solution, but it works for now.

To downgrade just uninstall the Protect from the web gui. Then SSH into the UDM and run the following commands:

apt-get update

apt-get install --reinstall --allow-downgrades unifi-protect=3.0.26 -y

I use Protect 3.0.26 above as that seems to work. I havent tried other versions, but this seems like the lates official stable release before v4.

This worked for me. Hopefully it is just a bug on Ubiquiti's end and not them trying to sabotage people who want to use 3rd party cameras.

samsong commented 3 weeks ago

Hello everyone. Full steps to fix this problem worked for me. thanks to people above.

chrome browser - incognito

  1. uninstall protect

  2. reboot

  3. install protect

  4. test. not working. error "cannot complete request" OK continue to next step.

  5. Follow instructions above - enable ssh, login & downgrade to 3.0.26

  6. OK protect opens now in this version

  7. Check "cameras/devices" & I saw the old unifi proxy camera still in the database. DELETE IT!

  8. Update Unifi Protect to version 4.0 again.

  9. OK SUCCESS. Protect website opens now!

NOTE: As per above, if you want to keep using unifi proxy cam you need to stay on version 3.0.26 & disable automatic application updates!

I think we can mark this issue resolved & mark this as the full solution? It will be nice to know / find a workaround in version 4 for unifi-proxy cameras & keeping the Web GUI working though!

rdamazio commented 3 weeks ago

I think we can mark this issue resolved & mark this as the full solution?

Well, no, it'll be resolved when it doesn't happen or require a workaround to begin with :) (by not crashing Protect, even if it still doesn't work or shows an error on the cam-proxy side about versions)

dasuchin commented 3 weeks ago

I can't get this to unbrick itself. I removed the docker containers, I logged in to the unfi remote console and removed the cameras manually from protect. I uninstalled protect, restarted, re-installed protect. Nothing seems to work. I have some UI cameras coming in the mail, so I wanted to get this prepped before they came. Now I don't know if this will work at all once they come, and I'd rather not do a factory reset on my set up.

Any other ideas?

zzzbatmand commented 3 weeks ago

I think we can mark this issue resolved & mark this as the full solution?

Well, no, it'll be resolved when it doesn't happen or require a workaround to begin with :) (by not crashing Protect, even if it still doesn't work or shows an error on the cam-proxy side about versions)

It appears to be fixed. The newly released v4.0.33 don't seem to do this any more. I have tried it with the :dev build (as the main still seems to have a broken pipe issue #344) :latest are also missing all G5 cameras as well as MQTT credentials for Frigate.

chadcrum commented 2 weeks ago

I can't get this to unbrick itself. I removed the docker containers, I logged in to the unfi remote console and removed the cameras manually from protect. I uninstalled protect, restarted, re-installed protect. Nothing seems to work. I have some UI cameras coming in the mail, so I wanted to get this prepped before they came. Now I don't know if this will work at all once they come, and I'd rather not do a factory reset on my set up.

Any other ideas?

Have you tried clearing your browser cache or incognito/private mode after reinstalling protect? The issue remained for me until I did that.