ptrumpis / snap-camera-server

An alternative, self-hosted solution that allows you to continue using Snap Camera with all Snapchat filters after its shutdown on January 25, 2023.
https://github.com/snapcamera
MIT License
321 stars 35 forks source link

Error starting the docker-image with podman #29

Closed sverit closed 1 year ago

sverit commented 1 year ago

Describe the bug When I try to run the built docker image I get a JS error and the container exits. The var MEDIA_DIR seems to be undefined and so the .replace() method cannot be called on it which leads to an uncaught error when trying to importFromAppCache().

To Reproduce Steps to reproduce the behavior:

  1. Build docker image and run it.

Expected behavior Container is started and runs.

Screenshots Docker-logfile when trying to run the container:

file:///usr/src/app/src/utils/importer.js:12
const mediaDir = process.env.MEDIA_DIR.replace(/^\/+/, '');
                                       ^

TypeError: Cannot read properties of undefined (reading 'replace')
    at file:///usr/src/app/src/utils/importer.js:12:40
    at ModuleJob.run (node:internal/modules/esm/module_job:193:25)
    at async Promise.all (index 0)
    at async ESMLoader.import (node:internal/modules/esm/loader:530:24)
    at async loadESM (node:internal/process/esm_loader:91:5)
    at async handleMainPromise (node:internal/modules/run_main:65:12)

System (please complete the following information):

Additional context I use podman instead of docker.

ptrumpis commented 1 year ago

I don't know about podman but I assume you are not using docker-compose to run the container. In that case you will have to uncomment a few lines in your .env file. There is a section located at the bottom:

##############################################################
# Changes below this line are not required and not recommended
# Docker Compose will auto set everything correctly
# These values are meant for standalone usage without Docker
# Running inside a virtual machine for example
##############################################################

# values will be set by Docker if you run docker compose
#DB_HOST=localhost
#DB_PORT=3306
#DB_NAME=snapcamera
#DB_USER=root
#DB_PASS=123456
#PORT=5645
#STORAGE_SERVER=http://studio-app.snapchat.com:80
#STORAGE_PATH=/var/lib/snapcamera
#IMPORT_DIR=import
#MEDIA_DIR=snap-camera-media
#MEDIA_DIR_ALT=snap-camera-media-alt
sverit commented 1 year ago

Hi,

thank you, yes, I use podman to build the image from the containerfile. Uncommenting the lines in the .env file did not help unfortunately. So I installed the podman-compose python script as a replacement for docker-compose[1] via pip install podman-compose and i had to switch to podmans rootful mode via

podman machine stop
podman machine set --rootful

so that opening port 443 is allowed and the lenses could be downloaded.

That works fine, thank you very much! :)

snap

[1] https://github.com/containers/podman-compose