Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Step 4 doesn't work Error: Cannot enqueue Query after fatal error. #7

Closed
That-David-Guy opened this issue Aug 8, 2016 · 2 comments
Closed

Comments

@That-David-Guy
Copy link

That-David-Guy commented Aug 8, 2016

Hi

Really good tutorial, but sadly I can't get the final step with docker-composer to work.

I've also tried pulling your repo and running that but I seem to get the same error from the users-service

Error: An error occured getting the users: Error: Cannot enqueue Query after fatal error.

It works if I run each container separately.

I also ran into this issue in step 2 if it matters: #4 . I don't know how to fix it in docker-file though as I don't know where to put the sleep

Any help would be fantastic.

Cheers

I'm on a macbook air using Docker for Mac

@kitgary
Copy link

kitgary commented Aug 10, 2016

I modified the docker-compose file as follows.


version: '2'
services:
  users-service:
    build:
      ./users-service
    container_name: users_service
    command: bash -c "sleep 10; node /app/index.js"
    ports:
      - 8123:8123
    links:
      - db:db
    environment:
      - DATABASE_HOST=db
  db:
    build: ./test-database
    container_name: db
    ports:
      - 3306:3306

I added the command for sleep 10 seconds to wait for the mysql database start up. And also I need to add the container_name, otherwise the mysql container cannot be linked to the users-service properly.

Cheers

@That-David-Guy
Copy link
Author

Thanks. Works!

So I assume the problem was that user-service starts before the db had actually finished?

I also notice you removed depends_on, does links replace it?

I'll close the issue

edwastone added a commit to edwastone/node-docker-microservice that referenced this issue Sep 6, 2016
Cute0110 added a commit to Cute0110/Node_Docker_Microservices that referenced this issue Sep 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants