Skip to content

panic: runtime error: invalid memory address or nil pointer dereference #30

Description

@adizukerman

First, thank you for all the work on this, it is great!

A couple of months may ago, it is has stopped working. I only now had a chance to check the container logs. I'm getting the following error. Any help would be appreciated!

28 Jun 25 21:39 UTC INF Application started

28 Jun 25 21:39 UTC INF No .env file found. Using only environment variables path=/app/.env

28 Jun 25 21:39 UTC INF Setting log level to info

28 Jun 25 21:39 UTC INF Loaded app session from the file filename=/data/session.json

28 Jun 25 21:39 UTC INF RTMP server started addr=:1936

28 Jun 25 21:39 UTC INF Connected to websocket url=wss://api.nanit.com/focus/cameras/XXXX/user_connect

panic: runtime error: invalid memory address or nil pointer dereference

[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x7b4bee]

goroutine 38 [running]:

github.com/indiefan/home_assistant_nanit/pkg/mqtt.(*Connection).RegisterLightHandler(...)

/app/pkg/mqtt/mqtt.go:60

github.com/indiefan/home_assistant_nanit/pkg/app.(*App).runWebsocket(0xc0000a4240, {0xc000010818, 0x8}, 0xc0001077a0, {0x9a7798, 0xc000140400})

/app/pkg/app/app.go:152 +0x10e

github.com/indiefan/home_assistant_nanit/pkg/app.(*App).handleBaby.func1(0x0?, {0x9a7798?, 0xc000140400?})

/app/pkg/app/app.go:91 +0x3b

github.com/indiefan/home_assistant_nanit/pkg/client.(*WebsocketConnectionManager).run.func1.1.notifyReadyHandler.1({0x9a7798?, 0xc000140400?})

/app/pkg/client/websocket.go:189 +0x2e

github.com/indiefan/home_assistant_nanit/pkg/utils.(*gracefulCtx).RunAsChild.func1({0x9a7798?, 0xc000140400?})

/app/pkg/utils/graceful.go:106 +0x33

github.com/indiefan/home_assistant_nanit/pkg/utils.RunWithGracefulCancel.func1()

/app/pkg/utils/graceful.go:39 +0x27

created by github.com/indiefan/home_assistant_nanit/pkg/utils.RunWithGracefulCancel in goroutine 33

/app/pkg/utils/graceful.go:38 +0xc5

Here is my Docker Compose if helpful (I run it with wyze bridge as well but I excluded that part of the compose file):
services:
nanit:
container_name: nanit
# network_mode: bridge_cam
networks:
- cam_network
# Image to pull, adjust the :suffix for your version tag
#image: registry.gitlab.com/adam.stanek/nanit:v0-7
#image: registry.gitlab.com/adam.stanek/nanit:latest
image: indiefan/nanit:latest
# Makes the container auto-start whenever you restart your computer
restart: unless-stopped
# Expose the RTMP port
ports:
- 1936:1936
# Configuration (see .env.sample file for all the options)

    environment:
        - "NANIT_EMAIL=XXX@gmail.com"
        - "NANIT_PASSWORD=XXX"
        - "NANIT_RTMP_ADDR=XXX:1936"
        - "NANIT_MQTT_ENABLED=false"
        - "NANIT_MQTT_BROKER_URL=XXX:1883" e
        - "NANIT_MQTT_USERNAME=XXXX"
        - "NANIT_MQTT_PASSWORD="
        - "NANIT_REFRESH_TOKEN=XXXX"
    volumes:
        - nanit_data:/data

volumes:
nanit_data:
external: true

networks:
cam_network:
external: True

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions