Skip to content
This repository has been archived by the owner on Nov 29, 2023. It is now read-only.

Error: You must set GRAPHQL_HOST environment variable prior to using Apollo. #27

Open
alanhenschel opened this issue Feb 15, 2020 · 12 comments

Comments

@alanhenschel
Copy link

Build error occurred
Error: You must set GRAPHQL_HOST environment variable prior to using Apollo.

i have this error when i try to run yarn dev. I using Ubuntu.

@alanhenschel
Copy link
Author

and "make in" doesn't work too

@Selhar
Copy link
Contributor

Selhar commented Feb 17, 2020

have you figured it out @alanhenschel ? They should be automatically set.

@alanhenschel alanhenschel reopened this Feb 17, 2020
@alanhenschel
Copy link
Author

have you figured it out @alanhenschel ? They should be automatically set.

No, they just don't work, I get login but now return another error, Type error on a function Uma graphql where trow errors

@marcosvlehmkuhl
Copy link

Is the docker container up?

@alanhenschel
Copy link
Author

Is the docker container up?

Yes, I do all the steps, but "make in" doesn't work, so I keep going and start next.js, the login screen appears but I can't go forward. Drupal works fine.

@marcosvlehmkuhl
Copy link

When you try to login the POST request is sent to what address?

@alanhenschel
Copy link
Author

When you try to login the POST request is sent to what address?

Redirect to the root, on my case localhost:3000, te full error message is: I handled rejection(type error): err.graphQLErrors[0] is undefined

@marcosvlehmkuhl
Copy link

So I believe the problem is since you are running the Next.js outside the container, localhost:3000/graphql is not a valid endpoint because the graphql server is inside the container. Setting the GRAPHQL_HOST variable to http://${docker-container-ip}:3000 should work.

What is the error when you make in?

@alanhenschel
Copy link
Author

So I believe the problem is since you are running the Next.js outside the container, localhost:3000/graphql is not a valid endpoint because the graphql server is inside the container. Setting the GRAPHQL_HOST variable to http://${docker-container-ip}:3000 should work.

What is the error when you make in?

Error: docker exec requires at least 2 arguments

@alanhenschel
Copy link
Author

So I believe the problem is since you are running the Next.js outside the container, localhost:3000/graphql is not a valid endpoint because the graphql server is inside the container. Setting the GRAPHQL_HOST variable to http://${docker-container-ip}:3000 should work.

What is the error when you make in?

Setting the variable gives another error: only absolute URLs are supported

@marcosvlehmkuhl
Copy link

Sorry, my mistake, the GRAPHQL_HOST shoud not have the port so it should actually be http://${docker-container-ip}/graphql

And you also have to remove the port 3000 mapping from the app container.

diff --git a/docker-compose.yml b/docker-compose.yml
index a22810f..a28fb37 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -22,7 +22,6 @@ services:
     hostname: app
     ports:
       - "80:80"
-      - "3000:3000"
     dns:
       - 8.8.8.8
     cap_add:

@marcosvlehmkuhl
Copy link

About the make in error it occurs when the terminal window is too small 😛.
But you could enter the container with docker exec. All you gotta do is run docker ps and get the container id, and then docker exec -it ${container_id} /bin/bash

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants