appengine
appengine copied to clipboard
Connecting to datastore emulator doesn't work with v0.7.0+
We have been running on v0.6.1 for a while and just upgraded to the latest version but can't connect to our datastore emulator anymore. We checked which version broke it, and appears to be v0.7.0: Refactored to use package:grpc to talk to Logging and Datastore backends. which fits with the error message we get:
Unhandled exception:
gRPC Error (14, Error connecting: SocketException: OS Error: Connection refused, errno = 61, address = localhost, port = 53263)
#0 GrpcDatastoreImpl.query (package:appengine/src/grpc_api_impl/datastore_impl.dart:258:41)
<asynchronous suspension>
#1 Query.run.<anonymous closure> (package:gcloud/src/db/db.dart:246:12)
#2 StreamFromPages._onListen (package:gcloud/common.dart:72:5)
#3 _runGuarded (dart:async/stream_controller.dart:805:24)
#4 _StreamController._subscribe.<anonymous closure> (dart:async/stream_controller.dart:684:7)
#5 _BufferingStreamSubscription._guardCallback (dart:async/stream_impl.dart:414:13)
#6 _StreamController._subscribe (dart:async/stream_controller.dart:683:18)
#7 _ControllerStream._createSubscription (dart:async/stream_controller.dart:818:19)
#8 _StreamImpl.listen (dart:async/stream_impl.dart:472:9)
#9 new _ForwardingStreamSubscription (dart:async/stream_pipe.dart:123:10)
#10 _ForwardingStream._createSubscription (dart:async/stream_pipe.dart:91:16)
#11 _ForwardingStream.listen (dart:async/stream_pipe.dart:86:12)
#12 Stream.toList (dart:async/stream.dart:1048:10)
#13 createPageSitemap (package:_server/utils/sitemap.dart:23:12)
<asynchronous suspension>
#14 _startServer (package:_server/web_server/server.dart:63:9)
<asynchronous suspension>
#15 startServer.<anonymous closure> (package:_server/web_server/server.dart:34:60)
#16 withAppEngineServices.<anonymous closure> (package:appengine/src/appengine_internal.dart:37:51)
#17 _withAppEngineServicesInternal.<anonymous closure> (package:appengine/src/appengine_internal.dart:110:20)
<asynchronous suspension>
#18 _ServiceScope._fork.<anonymous closure> (package:gcloud/service_scope.dart:209:19)
#19 _rootRun (dart:async/zone.dart:1124:13)
#20 _CustomZone.run (dart:async/zone.dart:1021:19)
#21 _runZoned (dart:async/zone.dart:1516:10)
#22 runZoned (dart:async/zone.dart:1463:12)
#23 _ServiceScope._fork (package:gcloud/service_scope.dart:208:12)
#24 fork (package:gcloud/service_scope.dart:104:30)
#25 _withAppEngineServicesInternal (package:appengine/src/appengine_internal.dart:101:10)
#26 withAppEngineServices (package:appengine/src/appengine_internal.dart:37:5)
#27 withAppEngineServices (package:appengine/appengine.dart:150:10)
#28 startServer (package:_server/web_server/server.dart:34:28)
#29 main (file:///Users/enyo/Develop/exitlive/server/bin/server.dart:6:9)
<asynchronous suspension>
#30 _startIsolate.<anonymous closure> (dart:isolate-patch/isolate_patch.dart:303:32)
#31 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:172:12)
Do you have any suggestion on how to fix this?
Sounds like the datastore emulator doesn't do gRPC. I don't currently have time to dig into this, but will happily take pointers if you dig into what is breaking and where. A simplified reproduction sample would be a great start.
Thanks. will provide ASAP
Sweet, thanks!
Here is a gist of how to reproduce the problem.
As soon as requestHandler is called and a query is ran on the datastore emulator, the error occurs.
Any update on this? Not being able to use the datastore emulator is a big problem for us.
@jonasfj @domesticmouse sorry to bump this again, but is there a way this could be looked at? We are unable to upgrade any library at the moment because of this, and it's becoming more and more of a problem.
EDIT: Is there a way to connect to the real datastore from my local machine until this is fixed?
EDIT: Is there a way to connect to the real datastore from my local machine until this is fixed?
@enyo, Yes, see: https://github.com/dart-lang/appengine#running-without-docker Basically, create a GCP service account and export the key as json. And make sure to give the service account permissions to datastore.
In pub.dev development we use a fake in-memory gcloud datastore backed for unit tests, and we use a staging site for local development.
On topic, if you're interested in debugging this please dive in. We're happy to take contributions. Maybe it's just something simple... We could also remove this from the readme, so as to not advertize a feature that doesn't work anymore.
Thanks @jonasfj
I think that in the long run, having a local datastore emulator is quite crucial for development, so it would be great to get this fixed
I'm happy to help debugging this, but I have no idea how the communication between these two services is working. It would be great if somebody who made the breaking change could look at this.