Troubleshooting Dev Environment - ProjectSidewalk/SidewalkWebpage GitHub Wiki

Setup / docker troubleshooting

Here are some common problems we've encountered while setting up the dev environment along with potential solutions. We've ordered this list roughly based on when you might observe the problem in the setup process.

You can always ask questions in Slack #interns. We are here to help!

First, here's a table that you'll reference when setting up your dev env

City ID Database User
seattle-wa sidewalk_seattle
columbus-oh sidewalk_columbus
cdmx sidewalk_cdmx
spgg sidewalk_spgg
pittsburgh-pa sidewalk_pittsburgh
newberg-or sidewalk_newberg
washington-dc sidewalk
chicago-il sidewalk_chicago
amsterdam sidewalk_amsterdam
la-piedad sidewalk_la_piedad
oradell-nj sidewalk_oradell
validation-study sidewalk_validation
zurich sidewalk_zurich
taipei sidewalk_taipei
new-taipei-tw sidewalk_new_taipei
keelung-tw sidewalk_keelung
auckland sidewalk_auckland
cuenca sidewalk_cuenca
crowdstudy sidewalk_crowdstudy
burnaby sidewalk_burnaby
teaneck-nj sidewalk_teaneck
walla-walla-wa sidewalk_walla_walla
st-louis-mo sidewalk_st_louis
la-ca sidewalk_la
mendota-il sidewalk_mendota
knox-oh sidewalk_knox
kaohsiung-tw sidewalk_kaohsiung
taichung-tw sidewalk_taichung
cliffside-park-nj sidewalk_cliffside_park
blackhawk-hills-il sidewalk_blackhawk_hills
columbia-sc sidewalk_columbia
west-chester-pa sidewalk_west_chester
danville-il sidewalk_danville
detroit-mi sidewalk_detroit
hackensack-nj sidewalk_hackensack
clifton-nj sidewalk_clifton
maywood-nj sidewalk_maywood
madison-wi sidewalk_madison
tainan-nj sidewalk_tainan
niagara-falls-nj sidewalk_niagara_falls
chandigarh-india sidewalk_chandigarh

could not execute query: ERROR: schema "public" already exists

If you see an error like:

pg_restore: while PROCESSING TOC:
pg_restore: from TOC entry 9; 2615 2200 SCHEMA public postgres
pg_restore: error: could not execute query: ERROR:  schema "public" already exists
Command was: CREATE SCHEMA public;

This is actually the one error that you can simply ignore! :) It doesn't have any effect.

Execution exception: NoSuchElementException: None.get

If you see an error like:

Execution exception[NoSuchElementException: None.get](/ProjectSidewalk/SidewalkWebpage/wiki/NoSuchElementException:-None.get)

This is most likely because the data from the database is missing and you'd need to import the sql dump. The schema import that's a part of init script only sets the schema and does not import the data.

The "make" command is just not working

If it seems like commands that you run using make are just not working, first try reinstalling make. If the issue persists, one workaround has been to look at the Makefile and manually run each command that make is an alias for whenever you need to run something. For example, if you wanted to run make ssh target=web, you would instead run docker exec -it projectsidewalk-web /bin/bash (you can see where the comes from by looking at the Makefile).

Issues connecting to the database

If you are having trouble connecting to the database, one potential issue might be that your docker container for the database might not have the configs set correctly for listening addresses. ssh into the db container and edit the /var/lib/postgresql/data/postgresql.conf file, setting listen_addresses = '*'.

gpg: keyserver receive failed: Server indicated a failure

If you see an error like this on Windows:

gpg: keyserver receive failed: Server indicated a failure

your system is treating this warning as a fatal error and is not completing the build. To fix this, add this line to the Dockerfile at line 2:

ENV APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=1

ERROR: Cannot create container for service web: Conflict.

After restarting computer, you run > make dev but receive an error like this:

> make dev
projectsidewalk-db is up-to-date
Starting projectsidewalk-db ... done
ERROR: Cannot create container for service web: Conflict. The container name "/projectsidewalk-web" is already in use by container "abeedfd010f3bbf9e03d9725b69ab9560b796e9b7e48bef8ff656243fb40a494". You have to remove (or rename) that container to be able to reuse that name.
make: *** [docker-run] Error 1

What probably happened is that your computer was not shut down correctly, so the web container was not closed correctly. To fix, you can just remove that docker container: docker container rm /projectsidewalk-web.

Errors After Computer Was Shut Off With SidewalkWebpage running.

If you are using WSL with Windows, trying running wsl --shutdown in the command prompt. Docker should ask if you want to restart WSL. Click restart. Otherwise, just restart Docker manually and connect again to the WSL Distribution.

ERROR: Docker-Compose Command Failed On Mac

If you encounter an error with the Docker-Compose command on Mac, you may need to recreate the symlink.

  1. Review the documentation - (https://docs.docker.com/compose/install/) - in the installation scenarios to create a new symlink.
  2. Recreate the symlink using the following commands found in the documentation:
    sudo rm /usr/local/bin/docker-compose`
    sudo ln -s /Applications/Docker.app/Contents/Resources/cli-plugins/docker-compose /usr/local/bin/docker-compose`
    
    Note: This is a temporary solution.

ERROR: Docker-Compose No Such File or Directory

If you encounter docker-compose: No such file or directory, you need to update the Make file to use docker compose rather than docker-compose (the latter is deprecated). Newer versions of Docker Desktop use docker compose (without the hyphen) instead of docker-compose. To fix this, open up Makefile and change all docker-compose instances to docker compose

Full error:

jonfroehlich:~$make dev
make: docker-compose: No such file or directory
make: *** [docker-up-db] Error 1

Other development troubleshooting

type mismatch ... NoStream,Nothing ... NoStream/E2

Sometimes you'll see an error like the one above while writing somewhat complex queries using the Slick library. I've often found that the error message is somewhat misleading, and there are two different things that have helped before:

  1. Wrapping all your queries in .transactionally
  2. The above usually works, but one time it didn't and it ended up working when I used DBIO.seq().andThen()