GabiAxel / google-cloud-gui

GUI for Google Cloud Datastore emulator and production
MIT License
158 stars 28 forks source link

Can't set headers after they are sent #7

Open diegofrsilva opened 6 years ago

diegofrsilva commented 6 years ago

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

Env:

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 commented 6 years ago

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

kevvurs commented 6 years ago

+1

GabiAxel commented 6 years ago

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 commented 6 years ago

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 commented 6 years ago

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 commented 6 years ago

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 commented 6 years ago

I'm blocked too

szepeshazi commented 5 years ago

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 commented 5 years ago

+1

noppefoxwolf commented 5 years ago

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 commented 3 years ago

@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.