Troubleshooting

Instructions on how to troubleshoot issues

First Steps

  1. If your issue is a frontend issue

    1. Make sure you have all packages built using either npm run packages:build from the root to build all packages or npm run build inside the folder of the package to build

  2. If your issue is related to the backend

    1. Rebuilt the backend Docker image using npm run docker:build

    2. Flush and reseed the backend database using npm run docker:flush

  3. If your issue is related to Shopify checkout

    1. Make sure your Ngrok tunnel is working properly

    2. You may visit localhost:4040 to see if Ngrok is received webhooks from Shopify

    3. If Ngrok is not received webhooks, then something is wrong with Shopify's end, so check the Shopify admin dashboard to see if there is a webhook pointing the Ngrok URL

    4. Otherwise, if Ngrok is receiving webhooks, the backend must not be processing the webhooks correctly

Common Issues

Quick fix to try if something on the backend works on other people's laptop but not mine

Rebuild the backend Docker containers and rerun the backend

How do I enable built in Loopback debugging?

See Setting debug strings from the Loopback documentation. For example, to debug ACL issues, set DEBUG=loopback:security:*

How do I rename the database?

If you are using MySQL 8.0 with InnoDB, do the following:

  • Exec into the MySQL database using the mysql command line utility

  • Run CREATE DATABASE new_db_name;

  • (Optional, to create new user) CREATE USER 'edrop_db_user'@'%' IDENTIFIED BY 'password_goes_here';

  • (Optional, to grant user privileges) GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, RELOAD, PROCESS, REFERENCES, INDEX, ALTER, SHOW DATABASES, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT, TRIGGER ON *.* TO 'edrop_db_user'@'%' WITH GRANT OPTION;

  • (Bash script to rename tables): mysql -u dbUsername -p"dbPassword" old_db_name -Ne 'SHOW TABLES' | while read table; do mysql -u dbUsername -p"dbPassword" -Ne "RENAME TABLE old_db_name.$table TO new_db_name.$table"; done

  • For the above command, I recommend executing everything before the pipe first to see all the tables that will be affected

This uses the fact that we can "transfer" a table from one database to another with the following command: RENAME TABLE old_db_name.table_name TO new_db_name.table_name;

Source: https://chartio.com/resources/tutorials/how-to-rename-a-database-in-mysql/

I set the environment variables for connecting to the database but it doesn't work (permission denied error)

Make sure you set the environment variables in the same shell window that you run the server in. To verify the value was set correctly, use $ echo %ENV_VAR_NAME% for Windows and $ echo $ENV_VAR_NAME for Linux/MacOS.

Running the dev server results in an error

Check to see if you have all packages installed with npm install. Additionally, check if there are any issues with dependencies.

The frontend is not synced with backend

If you made changes to the backend and are encountering errors, make sure you do the following:

  1. Log out of the account if you were logged in

  2. Clear cookies (for localhost)

    1. Often there will be an issue where the user ID stored in a cookie does not correctly reflect a user ID in the backend

    2. This will likely happen if you are running the frontend, then reset the database in the backend.

  3. Restart backend

Port binding issue of Docker container on Windows 10

Error message:

Error invoking remote method ‘docker-start-container’: error: (HTTP code 500) server error — Ports are not available: listen tcp 0.0.0.0:xxxx: bind: An attempt was made to access a socket in a way forbidden by access permissions.

Solution: reset the “TCP Dynamic Port Range” to 49152–65535 by running the following command with administrator privileges, but you can also change it to a smaller range if you think it is too large.

netsh int ipv4 set dynamic tcp start=49152 num=16384

Then just reboot the computer.

Source of the problem and solution

Blank cart page after placing an order

Check the Shopify Setup to make sure the mode and environment variables are set correctly. Then delete all the local Docker images and rebuild all the Docker images and rerun the backend

Last updated