Repository navigation
"RangeError: Invalid value: Not in range 0..1114111, inclusive: -1" When connecting to postgresql 12 #844
Description
dart --version
Dart VM version: 2.8.2 (stable) (Mon May 11 15:06:42 2020 +0200) on "windows_x64"
aqueduct --version
Aqueduct CLI version: 3.3.0+1
Problem:
Following this tutorial: https://www.youtube.com/watch?v=sXk9nkdSVq4
I am trying to connect to PostgreSQL using
final persistentModel = PostgreSQLPersistentStore.fromConnectionInfo(
'sumit',
'qwerty',
'localhost',
5432,
'testdb',
);
I have an endpoint at "profile" which will retrieve the list from the database.
When I try to consume API at http://localhost:8888/profile
I get this stack trace
[INFO] aqueduct: PostgreSQL connecting, sumit@localhost:5432/testdb.
RangeError: Invalid value: Not in range 0..1114111, inclusive: -1
[SEVERE] aqueduct: GET /profile 135ms 500 {user-agent : Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36\nconnection : keep-alive\ncache-control : no-cache\naccept : /\naccept-language : en-US,en;q=0.9,hi;q=0.8\nsec-fetch-dest : empty\nsec-fetch-mode : cors\naccept-encoding : gzip, deflate, br\npostman-token : b23e93a2-8378-d22f-f3ab-bbed9601741a\nhost : localhost:8888\nsec-fetch-site : none\n} NoSuchMethodError: The getter
'hasExplicitlySetContentType' was called on null.
Receiver: null
Tried calling: hasExplicitlySetContentType #0 Object.noSuchMethod (dart:core-patch/object_patch.dart:53:5)
#1 ResourceController._process (package:aqueduct/src/http/resource_controller.dart:372:19)
#2 ResourceController.handle (package:aqueduct/src/http/resource_controller.dart:138:14)
#3 Controller.receive (package:aqueduct/src/http/controller.dart:174:30)
#4 _ControllerRecycler.receive (package:aqueduct/src/http/controller.dart:402:17)
#5 Controller.receive (package:aqueduct/src/http/controller.dart:206:28)
#6 Router.receive (package:aqueduct/src/http/router.dart:139:18)
#7 _RootZone.runUnaryGuarded (dart:async/zone.dart:1374:10)
#8 _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:339:11)
#9 _BufferingStreamSubscription._add (dart:async/stream_impl.dart:266:7)
#10 _ForwardingStreamSubscription._add (dart:async/stream_pipe.dart:134:11)
#11 _MapStream._handleData (dart:async/stream_pipe.dart:234:10)
#12 _ForwardingStreamSubscription._handleData (dart:async/stream_pipe.dart:166:13)
#13 _RootZone.runUnaryGuarded (dart:async/zone.dart:1374:10)
#14 _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:339:11)
#15 _BufferingStreamSubscription._add (dart:async/stream_impl.dart:266:7)
#16 _SyncStreamControllerDispatch._sendData (dart:async/stream_controller.dart:779:19)
#17 _StreamController._add (dart:async/stream_controller.dart:655:7)
#18 _StreamController.add (dart:async/stream_controller.dart:597:5)
#19 _HttpServer._handleRequest (dart:_http/http_impl.dart:2837:19)
#20 new _HttpConnection. (dart:_http/http_impl.dart:2596:19)
#21 _RootZone.runUnaryGuarded (dart:async/zone.dart:1374:10)
#22 _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:339:11)
#23 _BufferingStreamSubscription._add (dart:async/stream_impl.dart:266:7)
#24 _SyncStreamControllerDispatch._sendData (dart:async/stream_controller.dart:779:19)
#25 _StreamController._add (dart:async/stream_controller.dart:655:7)
#26 _StreamController.add (dart:async/stream_controller.dart:597:5)
#27 _HttpParser._headersEnd (dart:_http/http_parser.dart:399:19)
#28 _HttpParser._doParse (dart:_http/http_parser.dart:739:15)
#29 _HttpParser._parse (dart:_http/http_parser.dart:328:7)
#30 _HttpParser._onData (dart:_http/http_parser.dart:850:5)
#31 _RootZone.runUnaryGuarded (dart:async/zone.dart:1374:10)
#32 _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:339:11)
#33 _BufferingStreamSubscription._add (dart:async/stream_impl.dart:266:7)
#34 _SyncStreamControllerDispatch._sendData (dart:async/stream_controller.dart:779:19)
#35 _StreamController._add (dart:async/stream_controller.dart:655:7)
#36 _StreamController.add (dart:async/stream_controller.dart:597:5)
#37 _Socket._onData (dart:io-patch/socket_patch.dart:1982:41)
#38 _RootZone.runUnaryGuarded (dart:async/zone.dart:1374:10)
#39 _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:339:11)
#40 _BufferingStreamSubscription._add (dart:async/stream_impl.dart:266:7)
#41 _SyncStreamControllerDispatch._sendData (dart:async/stream_controller.dart:779:19)
#43 _StreamController.add (dart:async/stream_controller.dart:597:5)
#45 _NativeSocket.issueReadEvent.issue (dart:io-patch/socket_patch.dart:1019:14)
#46 _microtaskLoop (dart:async/schedule_microtask.dart:43:21)
#47 _startMicrotaskLoop (dart:async/schedule_microtask.dart:52:5)
#48 _runPendingImmediateCallback (dart:isolate-patch/isolate_patch.dart:118:13)
#49 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:169:5)
Can anyone help me out? What am I missing here?
Thanks,
Regards,
Sumit Sharma
Activity
weichengwu commentedon May 20, 2020
#841 helps
weichengwu commentedon May 20, 2020
if your current dart version is 2.8.x, try this:
pratibhashali commentedon May 20, 2020
Hey thank you for the reply,
downgrading to dart version 2.7.2 helped by running.
flutter version v1.12.13+hotfix.9I hope the error will be fixed for dart latest version 2.8.2.
weichengwu commentedon May 20, 2020
How about configing a separated dart env and aqueduct?
Keep the dart installed by Homebrew, and download dart 2.7.2 SDK from https://dart.dev/tools/sdk/archive, then install aqueduct in dart 2.7.2.
rodydavis commentedon May 20, 2020
This worked for me too. I was on the master channel of Flutter and needed to downgrade.
bambinoua commentedon May 26, 2020
When this bug will be fixed? Or is it a dart problem?
pratibhashali commentedon May 26, 2020
@bambinoua
Recently dart version was updated that has broken the current library version, we will have to wait for latest version of the aqueduct library.
Current version of aqueduct library (Aqueduct CLI version: 3.3.0+1) is compatible with dart version 2.7.2 .
dxps commentedon May 27, 2020
@weichengwu Thanks for the hint.
Just a small update on that path (to include the raw, not html):
Indeed, downgrading temporary to Dart 2.7.2 I had the database migration (
aqueduct db upgrade --database-config ./config/db_upgrade.yaml) working.rodydavis commentedon May 28, 2020
edufolly commentedon May 28, 2020
If you want to use dart > 2.7.0, you can add to
pubspec.yaml:To use aqueduct to upgrade the database:
pub run aqueduct db upgradeI don't have problems to use aqueduct with recent PostgreSQL plugin.
dxps commentedon Jun 1, 2020
Today Aqueduct version
4.0.0-b1has been published on pub.dev. 🥳You can install the CLI using
pub global activate aqueduct 4.0.0-b1And in the project's
pubspec.yamlyou can use it, together with the updated version ofaqueduct_testas below:And all of these using the recently released Dart SDK
2.8.3. Yay! 😄dxps commentedon Jun 2, 2020
@pratibhashali Just for the sake of keeping things clean, can you close this ticket?
Dshosev commentedon Jul 1, 2020
@DEVisions
You Sir, just saved my day!
Terterola commentedon Aug 4, 2020
Thank you so much! :D
warcayac commentedon Nov 18, 2020
Info
OS: Manjaro KDE Plasma
Dart: 2.10.3
PostgreSQL: 12.4
Description:
When trying to run this command (from Aqueduct's tutorial):
This error is showed even if I run:
In my Aqueduct project I modified
pubspec.yamland addedpostgres: 2.1.1, when trying run this command:A new error again. So I tried the devisions' solution:
Well I'm going from error to error. Can you be more specific about the system requirements for your framework to work as it should? Thanks.
rdnobrega commentedon Nov 22, 2020
I'm getting the same error, any results?
HasseneKh commentedon Nov 23, 2020
Me Too in have the same problem ,but with i have postgres 10
HasseneKh commentedon Nov 23, 2020
Solved 👍 for me , i have :
KuuBee commentedon Nov 24, 2020
I find a way to fix it
just open project in Android studio and open pubspec.yaml
click upper right corner
Pub upgradesolved for me
I guess there may be some problems with the dependency, but I can also know exactly why
pubspec.yaml:
warcayac commentedon Nov 24, 2020
First off, I'm using a Dart project not a Flutter project so there are some differences in its treatment.
My
pubspec.yamlin that time:Results when applying some suggestions:
Appending these lines to
pubspec.yamland updating my packages withdart pub get:Trying run the original command:
Trying run this command:
I finally succeeded but... at present I'm using FastAPI.
vinnytwice commentedon Jan 6, 2021
Hi everyone, I also struggled quite a bit with this error but finally got it to work with this following setup.
Dart needs to be installed globally, the version that comes with Flutter is just for Flutter projects(2.10):
I tried 2.8 and it worked just partially and only with
dependency_overrides: Postgres: 2.2.0active in pubspec.yaml .aqueduct db generateworks with this version but I'd still get the RangeError when runningaqueduct db upgradecommand.. so still pretty useless..I then tried 2.9 but it seems that this version doesn't allow CLI.. #903
So I finally tried 2.7 and both commands now work properly and without
dependency_overrides: Postgres: 2.2.0.Please share your working/not workin setups so we can all try different versions.
pubspec.yaml:
Hope this helps.
gonzalonm commentedon Jan 28, 2021
This is the unique solution that worked for me. Thanks!
fabioselau077 commentedon Feb 8, 2021
thanks!!! Working in 2021.
tbarbette commentedon Feb 17, 2021
As stated in multiple posts, it worked for me when I added the upgraded version reference and prefixed "dart pub run" to "aqueduct db upgrade ...". But can someone explain why? Am I missing a binary path?