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

Can't set headers after they are sent #7

Open
diegofrsilva opened this issue Jun 5, 2018 · 11 comments
Open

Can't set headers after they are sent #7

diegofrsilva opened this issue Jun 5, 2018 · 11 comments

Comments

@diegofrsilva
Copy link

Hi, I'm facing the following problem when I try to execute the project.

Env:

  • Installed using yarn command;
  • I'm running inside node:8 docker image (I had the same problem using a MAC);

Error:
[Tue Jun 05 2018 12:58:50 GMT+0000 (UTC)] WARNING { Error:
Some middleware threw an error that was not handled properly. This can happen when you do this:

// BAD:
server(ctx => { throw new Error('I am an error!'); });

To catch and handle these types of errors, add a route to the end of your middlewares to handle errors like this:

// GOOD:
const { error } = server.router;
const { status } = server.reply;

server(
  ctx => { throw new Error('I am an error!'); },
  // ...
  error(ctx => status(500).send(ctx.error.message))
);

Please feel free to open an issue in Github asking for more info:
https://github.com/franciscop/server

at buildError (/home/node/.config/yarn/global/node_modules/server/error/index.js:2:17)
at ErrorInstance (/home/node/.config/yarn/global/node_modules/server/error/index.js:19:12)
at AsyncFunction.handler.error.ctx [as error] (/home/node/.config/yarn/global/node_modules/server/plugins/final/index.js:23:19)
at Object.middle (/home/node/.config/yarn/global/node_modules/server/src/join/index.js:36:33)
at <anonymous>

status: 500,
namespace: '/plugin/final/',
code: '/plugin/final/unhandled',
id: 'plugin-final-unhandled' }
[Tue Jun 05 2018 12:58:50 GMT+0000 (UTC)] ERROR Error: Can't set headers after they are sent.
at validateHeader (_http_outgoing.js:491:11)
at ServerResponse.setHeader (_http_outgoing.js:498:3)
at ServerResponse.header (/home/node/.config/yarn/global/node_modules/express/lib/response.js:767:10)
at ServerResponse.send (/home/node/.config/yarn/global/node_modules/express/lib/response.js:170:12)
at stack.push.ctx (/home/node/.config/yarn/global/node_modules/server/reply/reply.js:152:13)
at Reply.exec (/home/node/.config/yarn/global/node_modules/server/reply/reply.js:175:11)
at processReturn (/home/node/.config/yarn/global/node_modules/server/src/join/index.js:11:22)
at Object.middle (/home/node/.config/yarn/global/node_modules/server/src/join/index.js:43:17)
at

@cawel
Copy link

cawel commented Jun 7, 2018

I am having the exact same issue. Using Node v9.11.1

@kevvurs
Copy link

kevvurs commented Jun 11, 2018

+1

@GabiAxel
Copy link
Owner

I get it too, but it doesn't seem to affect any functionality of the webapp. Does this prevent you from using the webapp in any way? If you open the browser devtools network tab, do you see any failed request (response status 4xx or 5xx) ?

I want to address this properly anyway, but I'm trying to understand the urgency of this.

@SamChou19815
Copy link

Namespaces are not properly loaded for me, and I see the same error messages.
screen shot 2018-06-25 at 4 21 06 pm

@ghost
Copy link

ghost commented Jul 10, 2018

Ran into this issue today. It does prevent usage. At least for me, it's perpetually stuck loading the contents of the default namespace.

@diegofrsilva
Copy link
Author

Indeed, even though the error message is there, it works. I'll keep the Issue as open because others reported they are blocked by this. @GabiAxel Feel free to close it if it isn't blocking others.

@m1m6
Copy link

m1m6 commented Sep 8, 2018

I'm blocked too

@szepeshazi
Copy link

Same here, running node 8.15.0. The namespaces and kinds requests are sent but don't get a response. GUI is stuck at "Loading..."

@noppefoxwolf
Copy link

+1

@noppefoxwolf
Copy link

I resolved this issue.
Project name and host is should be same as your environment.
You can check it when run gcloud beta emulators datastore env-init.
DATASTORE_DATASET and DATASTORE_HOST are correct.

@haopei
Copy link

haopei commented Jun 1, 2021

@noppefoxwolf, can you say how exactly you have made it work?

For me, I tried the following:

  1. I ran my app on localhost:5000
  2. Started the emulator at localhost:8081 by running gcloud beta emulators datastore start
  3. Automatically set environment variables by running $(gcloud beta emulators datastore env-init)

My environment variables are as follows:

export DATASTORE_DATASET=my-project-id
export DATASTORE_EMULATOR_HOST=localhost:8081
export DATASTORE_EMULATOR_HOST_PATH=localhost:8081/datastore
export DATASTORE_HOST=http://localhost:8081
export DATASTORE_PROJECT_ID=my-project-id

My question is: what exactly should be the values for DATASTORE_DATASET and DATASTORE_HOST in my scenario?

If you can guide me here, it is appreciated beyond words.

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

9 participants