Skip to content
This repository has been archived by the owner on Mar 18, 2021. It is now read-only.

"RangeError: Invalid value: Not in range 0..1114111, inclusive: -1" When connecting to postgresql 12 #844

Open
pratibhashali opened this issue May 20, 2020 · 24 comments

Comments

@pratibhashali
Copy link

pratibhashali commented May 20, 2020

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

@weichengwu
Copy link

#841 helps

@weichengwu
Copy link

weichengwu commented May 20, 2020

if your current dart version is 2.8.x, try this:

brew uninstall dart

brew install https://github.com/dart-lang/homebrew-dart/blob/fed6de080aef54c4f1c1df732424df37cd3e5a3e/dart.rb

@pratibhashali
Copy link
Author

Hey thank you for the reply,

downgrading to dart version 2.7.2 helped by running.

flutter version v1.12.13+hotfix.9

I hope the error will be fixed for dart latest version 2.8.2.

@weichengwu
Copy link

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
Copy link

flutter version v1.12.13+hotfix.9

This worked for me too. I was on the master channel of Flutter and needed to downgrade.

@bambinoua
Copy link

When this bug will be fixed? Or is it a dart problem?

@pratibhashali
Copy link
Author

@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
Copy link

dxps commented May 27, 2020

@weichengwu Thanks for the hint.

Just a small update on that path (to include the raw, not html):

$ brew install https://raw.githubusercontent.com/dart-lang/homebrew-dart/fed6de080aef54c4f1c1df732424df37cd3e5a3e/dart.rb

Indeed, downgrading temporary to Dart 2.7.2 I had the database migration (aqueduct db upgrade --database-config ./config/db_upgrade.yaml) working.

@rodydavis
Copy link

rodydavis commented May 28, 2020 via email

@edufolly
Copy link

If you want to use dart > 2.7.0, you can add to pubspec.yaml:

dependency_overrides:
  postgres: 2.1.1

To use aqueduct to upgrade the database:
pub run aqueduct db upgrade

I don't have problems to use aqueduct with recent PostgreSQL plugin.

@dxps
Copy link

dxps commented Jun 1, 2020

Today Aqueduct version 4.0.0-b1 has been published on pub.dev. 🥳

You can install the CLI using pub global activate aqueduct 4.0.0-b1

And in the project's pubspec.yaml you can use it, together with the updated version of aqueduct_test as below:

...
dependencies:
  aqueduct: ^4.0.0-b1

dev_dependencies:
  test: ^1.0.0
  aqueduct_test: ^2.0.0-b1

And all of these using the recently released Dart SDK 2.8.3. Yay! 😄

@dxps
Copy link

dxps commented Jun 2, 2020

@pratibhashali Just for the sake of keeping things clean, can you close this ticket?

@Dshosev
Copy link

Dshosev commented Jul 1, 2020

Today Aqueduct version 4.0.0-b1 has been published on pub.dev. 🥳

You can install the CLI using pub global activate aqueduct 4.0.0-b1

And in the project's pubspec.yaml you can use it, together with the updated version of aqueduct_test as below:

...
dependencies:
  aqueduct: ^4.0.0-b1

dev_dependencies:
  test: ^1.0.0
  aqueduct_test: ^2.0.0-b1

And all of these using the recently released Dart SDK 2.8.3. Yay! 😄

@DEVisions
You Sir, just saved my day!

@Terterola
Copy link

Today Aqueduct version 4.0.0-b1 has been published on pub.dev. 🥳

You can install the CLI using pub global activate aqueduct 4.0.0-b1

And in the project's pubspec.yaml you can use it, together with the updated version of aqueduct_test as below:

...
dependencies:
  aqueduct: ^4.0.0-b1

dev_dependencies:
  test: ^1.0.0
  aqueduct_test: ^2.0.0-b1

And all of these using the recently released Dart SDK 2.8.3. Yay! 😄

Thank you so much! :D

@warcayac
Copy link

Info

  • OS: Manjaro KDE Plasma

  • Dart: 2.10.3

  • PostgreSQL: 12.4

Description:

$ dart pub global activate aqueduct
$ aqueduct --version
Aqueduct CLI version: 3.3.0+1

When trying to run this command (from Aqueduct's tutorial):

$ aqueduct db upgrade --connect postgres://heroes_user:password@localhost:5432/heroes
-- Aqueduct CLI Version: 3.3.0+1
-- Aqueduct project version: 3.3.0+1
*** Uncaught error
    RangeError: Invalid value: Not in inclusive range 0..1114111: -1
  **** Stacktrace
  * #0      StringBuffer.writeCharCode (dart:core-patch/string_buffer_patch.dart:74:9)
  * #1      PostgreSQLFormat.substitute (package:postgres/src/substituter.dart:83:29)
  * #2      Query.sendExtended (package:postgres/src/query.dart:61:38)
  * #3      _PostgreSQLConnectionStateIdle.processQuery (package:postgres/src/connection_fsm.dart:182:9)
  * #4      _PostgreSQLConnectionStateIdle.awake (package:postgres/src/connection_fsm.dart:168:14)
  * #5      _PostgreSQLExecutionContextMixin._enqueue (package:postgres/src/connection.dart:399:67)
  * #6      _PostgreSQLExecutionContextMixin.query (package:postgres/src/connection.dart:318:12)
  * #7      PostgreSQLPersistentStore.execute (package:aqueduct/src/db/postgresql/postgresql_persistent_store.dart:153:37)
  * <asynchronous suspension>
  * #8      PostgreSQLPersistentStore.schemaVersion (package:aqueduct/src/db/postgresql/postgresql_persistent_store.dart:216:26)
  * #9      CLIDatabaseUpgrade.handle (package:aqueduct/src/cli/commands/db_upgrade.dart:28:52)
  * #10     CLICommand.process (package:aqueduct/src/cli/command.dart:159:20)
  * <asynchronous suspension>
  * #11     CLICommand.process (package:aqueduct/src/cli/command.dart:135:12)
  * #12     CLICommand.process (package:aqueduct/src/cli/command.dart:135:12)
  * #13     main (file:///home/warcayac/.pub-cache/hosted/pub.dartlang.org/aqueduct-3.3.0+1/bin/aqueduct.dart:9:27)
  * #14     _startIsolate.<anonymous closure> (dart:isolate-patch/isolate_patch.dart:299:32)
  * #15     _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:168:12)
  ****

This error is showed even if I run:

$ dart pub run aqueduct db upgrade --connect postgres://heroes_user:password@localhost:5432/heroes

In my Aqueduct project I modified pubspec.yaml and added postgres: 2.1.1, when trying run this command:

$ dart pub get                                                                                    
Resolving dependencies... 
Because heroes depends on aqueduct 3.3.0+1 which depends on postgres ^1.0.0, postgres ^1.0.0 is required.
So, because heroes depends on postgres ^2.2.0, version solving failed.

A new error again. So I tried the devisions' solution:

$ dart pub global deactivate aqueduct
$ dart pub global activate aqueduct 4.0.0-b1
Resolving dependencies... (2.1s)
+ _fe_analyzer_shared 13.0.0
+ analyzer 0.41.0
+ aqueduct 4.0.0-b1
+ args 1.6.0
+ async 2.4.2
+ buffer 1.0.7
+ charcode 1.1.3
+ checked_yaml 1.0.2
+ cli_util 0.2.0
+ codable 1.0.0
+ collection 1.14.13
+ convert 2.1.1
+ crypto 2.1.5
+ glob 1.2.0
+ isolate_executor 2.0.2+3
+ js 0.6.2
+ json_annotation 3.1.0
+ logging 0.11.4
+ meta 1.2.3
+ node_interop 1.2.0
+ node_io 1.1.1
+ open_api 2.0.1
+ package_config 1.9.3
+ password_hash 2.0.0
+ path 1.7.0
+ pedantic 1.9.2
+ postgres 2.2.0
+ pub_cache 0.2.3
+ pub_semver 1.4.4
+ pubspec_parse 0.1.5
+ runtime 1.0.0-9
+ safe_config 3.0.0-b2
+ source_span 1.7.0
+ string_scanner 1.0.5
+ term_glyph 1.1.0
+ typed_data 1.2.0
+ watcher 0.9.7+15
+ yaml 2.2.1
Precompiling executables... (5.9s)
Failed to precompile aqueduct:aqueduct:
../../../../../.pub-cache/hosted/pub.dartlang.org/isolate_executor-2.0.2+3/lib/src/source_generator.dart:6:8: Error: Error when reading '../../../../../.pub-cache/hosted/pub.dartlang.org/analyzer-0.41.0/lib/analyzer.dart': No such file or directory
import 'package:analyzer/analyzer.dart';
       ^
../../../../../.pub-cache/hosted/pub.dartlang.org/isolate_executor-2.0.2+3/lib/src/source_generator.dart:52:17: Error: Type 'ClassDeclaration' not found.
  static Future<ClassDeclaration> _getClass(Type type) async {
                ^^^^^^^^^^^^^^^^
../../../../../.pub-cache/hosted/pub.dartlang.org/isolate_executor-2.0.2+3/lib/src/source_generator.dart:54:22: Error: Method not found: 'parseDartFile'.
    final fileUnit = parseDartFile(uri.toFilePath(windows: Platform.isWindows));
                     ^^^^^^^^^^^^^
../../../../../.pub-cache/hosted/pub.dartlang.org/isolate_executor-2.0.2+3/lib/src/source_generator.dart:58:28: Error: 'ClassDeclaration' isn't a type.
        .where((u) => u is ClassDeclaration)
                           ^^^^^^^^^^^^^^^^
../../../../../.pub-cache/hosted/pub.dartlang.org/isolate_executor-2.0.2+3/lib/src/source_generator.dart:59:28: Error: 'ClassDeclaration' isn't a type.
        .map((cu) => cu as ClassDeclaration)
                           ^^^^^^^^^^^^^^^^

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
Copy link

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.

I'm getting the same error, any results?

@HasseneKh
Copy link

HasseneKh commented Nov 23, 2020

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.

Me Too in have the same problem ,but with i have postgres 10

@HasseneKh
Copy link

HasseneKh commented Nov 23, 2020

Solved 👍 for me , i have :

Flutter : 1.22.0-10.0.pre.89 
dart: 2.10.0 
postgres : 10
Aqueduct CLI Version: 3.3.0+1
Aqueduct project version: 3.2.1
environment:
  sdk: ">=2.0.0 <3.0.0"

dependencies:
  aqueduct: ^3.0.0

dev_dependencies:
  test: ^1.0.0
  aqueduct_test: ^1.0.0
  
dependency_overrides:
  postgres: 2.1.1

@KuuBee
Copy link

KuuBee commented Nov 24, 2020

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.

I'm getting the same error, any results?

I find a way to fix it
just open project in Android studio and open pubspec.yaml
click upper right corner Pub upgrade
solved for me
I guess there may be some problems with the dependency, but I can also know exactly why
pubspec.yaml:

name: heroes
description: An empty Aqueduct application.
version: 0.0.1
author: stable|kernel <jobs@stablekernel.com>

environment:
  sdk: ">=2.0.0 <3.0.0"

dependencies:
  aqueduct: ^3.0.0

dev_dependencies:
  test: ^1.0.0
  aqueduct_test: ^1.0.0

dependency_overrides:
  postgres: 2.1.1
dart: 2.11.0-213.1.beta
postgres: 13
Aqueduct CLI Version: 3.3.0+1

@warcayac
Copy link

First off, I'm using a Dart project not a Flutter project so there are some differences in its treatment.

My pubspec.yaml in that time:

name: heroes
description: An empty Aqueduct application.
version: 0.0.1
author: stable|kernel <jobs@stablekernel.com>

environment:
  sdk: ">=2.0.0 <3.0.0"

dependencies:
  aqueduct: 3.3.0+1

dev_dependencies:
  aqueduct_test: ^1.0.0
  test: ^1.0.0

Results when applying some suggestions:

$ dart pub upgrade                                                                                
Resolving dependencies... (3.6s)
  analyzer 0.35.4 (0.41.0 available)
  aqueduct 3.3.0+1
  aqueduct_test 1.0.1
  args 1.6.0
  async 2.4.2
  boolean_selector 1.0.5 (2.0.0 available)
  charcode 1.1.3
  codable 1.0.0
  collection 1.14.13
  convert 2.1.1
  crypto 2.1.5
+ file 5.2.1
  front_end 0.1.14 (0.1.29 available)
  glob 1.2.0
  http 0.12.2
  http_multi_server 2.2.0
  http_parser 3.1.4
+ intl 0.16.1
  io 0.3.4
  isolate_executor 2.0.2+3
  js 0.6.2
  json_rpc_2 2.2.2
  kernel 0.3.14 (0.3.29 available)
  logging 0.11.4
  matcher 0.12.5 (0.12.9 available)
> meta 1.2.4 (was 1.2.3)
  mime 0.9.7
  multi_server_socket 1.0.2
> node_interop 1.2.1 (was 1.2.0)
> node_io 1.2.0 (was 1.1.1)
  node_preamble 1.4.12
  open_api 2.0.1
  package_config 1.9.3
  package_resolver 1.0.10
  password_hash 2.0.0
  path 1.7.0
  pedantic 1.9.2
  pool 1.4.0
  postgres 1.0.2 (2.2.0 available)
  pub_cache 0.2.3
  pub_semver 1.4.4
  safe_config 2.0.2
  shelf 0.7.9
  shelf_packages_handler 1.0.4 (2.0.0 available)
  shelf_static 0.2.8
  shelf_web_socket 0.2.3
  source_map_stack_trace 1.1.5 (2.0.0 available)
  source_maps 0.10.9
  source_span 1.7.0
  stack_trace 1.9.6
  stream_channel 2.0.0
  string_scanner 1.0.5
  term_glyph 1.1.0
  test 1.6.3 (1.15.7 available)
  test_api 0.2.5 (0.2.18+1 available)
  test_core 0.2.5 (0.3.11+4 available)
  typed_data 1.2.0
  vm_service_client 0.2.6+3
  watcher 0.9.7+15
  web_socket_channel 1.1.0
  yaml 2.2.1
Downloading node_io 1.2.0...
Downloading node_interop 1.2.1...
Downloading meta 1.2.4...
Downloading file 5.2.1...
Changed 5 dependencies!
11 packages have newer versions incompatible with dependency constraints.
Try `pub outdated` for more information.

Appending these lines to pubspec.yaml and updating my packages with dart pub get:

dependency_overrides:
  postgres: 2.2.0

Trying run the original command:

$ aqueduct db upgrade --connect postgres://heroes_user:password@localhost:5432/heroes
-- Aqueduct CLI Version: 3.3.0+1
-- Aqueduct project version: 3.3.0+1
*** Uncaught error
    RangeError: Invalid value: Not in inclusive range 0..1114111: -1
  **** Stacktrace
.....

Trying run this command:

$ dart pub run aqueduct db upgrade --connect postgres://heroes_user:password@localhost:5432/heroes
Precompiling executable... (12.4s)
Precompiled aqueduct:aqueduct.
-- Aqueduct CLI Version: 3.3.0+1
-- Aqueduct project version: 3.3.0+1
-- Updating to version 1 on new database...
    PostgreSQL connecting, heroes_user@localhost:5432/heroes.
    Initializating database...
        CREATE TABLE _aqueduct_version_pgsql (versionNumber INT NOT NULL UNIQUE,dateOfUpgrade TIMESTAMP NOT NULL)
    Applying migration version 1...
        CREATE TABLE _Hero (id BIGSERIAL PRIMARY KEY,name TEXT NOT NULL UNIQUE)
    Seeding data from migration version 1...
    Query:execute (4ms) INSERT INTO _Hero (name) VALUES (@name) -> []
    Query:execute (1ms) INSERT INTO _Hero (name) VALUES (@name) -> []
    Query:execute (0ms) INSERT INTO _Hero (name) VALUES (@name) -> []
    Query:execute (0ms) INSERT INTO _Hero (name) VALUES (@name) -> []
    Query:execute (0ms) INSERT INTO _Hero (name) VALUES (@name) -> []
    Applied schema version 1 successfully.

I finally succeeded but... at present I'm using FastAPI.

@vinnytwice
Copy link

vinnytwice commented 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.0 active in pubspec.yaml . aqueduct db generate works with this version but I'd still get the RangeError when running aqueduct db upgrade command.. 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:

environment:
  sdk: ">=2.0.0 <3.0.0"

dependencies:
  aqueduct: 3.3.0+1

#  aqueduct: ^4.0.0-b1

#dependency_overrides:
#  postgres: 2.2.0

dev_dependencies:
  test: ^1.0.0
  aqueduct_test: ^1.0.0
#  aqueduct_test: ^2.0.0-b1

Hope this helps.

@gonzalonm
Copy link

gonzalonm commented Jan 28, 2021

First off, I'm using a Dart project not a Flutter project so there are some differences in its treatment.

My pubspec.yaml in that time:

name: heroes
description: An empty Aqueduct application.
version: 0.0.1
author: stable|kernel <jobs@stablekernel.com>

environment:
  sdk: ">=2.0.0 <3.0.0"

dependencies:
  aqueduct: 3.3.0+1

dev_dependencies:
  aqueduct_test: ^1.0.0
  test: ^1.0.0

Results when applying some suggestions:

$ dart pub upgrade                                                                                
Resolving dependencies... (3.6s)
  analyzer 0.35.4 (0.41.0 available)
  aqueduct 3.3.0+1
  aqueduct_test 1.0.1
  args 1.6.0
  async 2.4.2
  boolean_selector 1.0.5 (2.0.0 available)
  charcode 1.1.3
  codable 1.0.0
  collection 1.14.13
  convert 2.1.1
  crypto 2.1.5
+ file 5.2.1
  front_end 0.1.14 (0.1.29 available)
  glob 1.2.0
  http 0.12.2
  http_multi_server 2.2.0
  http_parser 3.1.4
+ intl 0.16.1
  io 0.3.4
  isolate_executor 2.0.2+3
  js 0.6.2
  json_rpc_2 2.2.2
  kernel 0.3.14 (0.3.29 available)
  logging 0.11.4
  matcher 0.12.5 (0.12.9 available)
> meta 1.2.4 (was 1.2.3)
  mime 0.9.7
  multi_server_socket 1.0.2
> node_interop 1.2.1 (was 1.2.0)
> node_io 1.2.0 (was 1.1.1)
  node_preamble 1.4.12
  open_api 2.0.1
  package_config 1.9.3
  package_resolver 1.0.10
  password_hash 2.0.0
  path 1.7.0
  pedantic 1.9.2
  pool 1.4.0
  postgres 1.0.2 (2.2.0 available)
  pub_cache 0.2.3
  pub_semver 1.4.4
  safe_config 2.0.2
  shelf 0.7.9
  shelf_packages_handler 1.0.4 (2.0.0 available)
  shelf_static 0.2.8
  shelf_web_socket 0.2.3
  source_map_stack_trace 1.1.5 (2.0.0 available)
  source_maps 0.10.9
  source_span 1.7.0
  stack_trace 1.9.6
  stream_channel 2.0.0
  string_scanner 1.0.5
  term_glyph 1.1.0
  test 1.6.3 (1.15.7 available)
  test_api 0.2.5 (0.2.18+1 available)
  test_core 0.2.5 (0.3.11+4 available)
  typed_data 1.2.0
  vm_service_client 0.2.6+3
  watcher 0.9.7+15
  web_socket_channel 1.1.0
  yaml 2.2.1
Downloading node_io 1.2.0...
Downloading node_interop 1.2.1...
Downloading meta 1.2.4...
Downloading file 5.2.1...
Changed 5 dependencies!
11 packages have newer versions incompatible with dependency constraints.
Try `pub outdated` for more information.

Appending these lines to pubspec.yaml and updating my packages with dart pub get:

dependency_overrides:
  postgres: 2.2.0

Trying run the original command:

$ aqueduct db upgrade --connect postgres://heroes_user:password@localhost:5432/heroes
-- Aqueduct CLI Version: 3.3.0+1
-- Aqueduct project version: 3.3.0+1
*** Uncaught error
    RangeError: Invalid value: Not in inclusive range 0..1114111: -1
  **** Stacktrace
.....

Trying run this command:

$ dart pub run aqueduct db upgrade --connect postgres://heroes_user:password@localhost:5432/heroes
Precompiling executable... (12.4s)
Precompiled aqueduct:aqueduct.
-- Aqueduct CLI Version: 3.3.0+1
-- Aqueduct project version: 3.3.0+1
-- Updating to version 1 on new database...
    PostgreSQL connecting, heroes_user@localhost:5432/heroes.
    Initializating database...
        CREATE TABLE _aqueduct_version_pgsql (versionNumber INT NOT NULL UNIQUE,dateOfUpgrade TIMESTAMP NOT NULL)
    Applying migration version 1...
        CREATE TABLE _Hero (id BIGSERIAL PRIMARY KEY,name TEXT NOT NULL UNIQUE)
    Seeding data from migration version 1...
    Query:execute (4ms) INSERT INTO _Hero (name) VALUES (@name) -> []
    Query:execute (1ms) INSERT INTO _Hero (name) VALUES (@name) -> []
    Query:execute (0ms) INSERT INTO _Hero (name) VALUES (@name) -> []
    Query:execute (0ms) INSERT INTO _Hero (name) VALUES (@name) -> []
    Query:execute (0ms) INSERT INTO _Hero (name) VALUES (@name) -> []
    Applied schema version 1 successfully.

I finally succeeded but... at present I'm using FastAPI.

This is the unique solution that worked for me. Thanks!

@fabioselau077
Copy link

First off, I'm using a Dart project not a Flutter project so there are some differences in its treatment.

My pubspec.yaml in that time:

name: heroes
description: An empty Aqueduct application.
version: 0.0.1
author: stable|kernel <jobs@stablekernel.com>

environment:
  sdk: ">=2.0.0 <3.0.0"

dependencies:
  aqueduct: 3.3.0+1

dev_dependencies:
  aqueduct_test: ^1.0.0
  test: ^1.0.0

Results when applying some suggestions:

$ dart pub upgrade                                                                                
Resolving dependencies... (3.6s)
  analyzer 0.35.4 (0.41.0 available)
  aqueduct 3.3.0+1
  aqueduct_test 1.0.1
  args 1.6.0
  async 2.4.2
  boolean_selector 1.0.5 (2.0.0 available)
  charcode 1.1.3
  codable 1.0.0
  collection 1.14.13
  convert 2.1.1
  crypto 2.1.5
+ file 5.2.1
  front_end 0.1.14 (0.1.29 available)
  glob 1.2.0
  http 0.12.2
  http_multi_server 2.2.0
  http_parser 3.1.4
+ intl 0.16.1
  io 0.3.4
  isolate_executor 2.0.2+3
  js 0.6.2
  json_rpc_2 2.2.2
  kernel 0.3.14 (0.3.29 available)
  logging 0.11.4
  matcher 0.12.5 (0.12.9 available)
> meta 1.2.4 (was 1.2.3)
  mime 0.9.7
  multi_server_socket 1.0.2
> node_interop 1.2.1 (was 1.2.0)
> node_io 1.2.0 (was 1.1.1)
  node_preamble 1.4.12
  open_api 2.0.1
  package_config 1.9.3
  package_resolver 1.0.10
  password_hash 2.0.0
  path 1.7.0
  pedantic 1.9.2
  pool 1.4.0
  postgres 1.0.2 (2.2.0 available)
  pub_cache 0.2.3
  pub_semver 1.4.4
  safe_config 2.0.2
  shelf 0.7.9
  shelf_packages_handler 1.0.4 (2.0.0 available)
  shelf_static 0.2.8
  shelf_web_socket 0.2.3
  source_map_stack_trace 1.1.5 (2.0.0 available)
  source_maps 0.10.9
  source_span 1.7.0
  stack_trace 1.9.6
  stream_channel 2.0.0
  string_scanner 1.0.5
  term_glyph 1.1.0
  test 1.6.3 (1.15.7 available)
  test_api 0.2.5 (0.2.18+1 available)
  test_core 0.2.5 (0.3.11+4 available)
  typed_data 1.2.0
  vm_service_client 0.2.6+3
  watcher 0.9.7+15
  web_socket_channel 1.1.0
  yaml 2.2.1
Downloading node_io 1.2.0...
Downloading node_interop 1.2.1...
Downloading meta 1.2.4...
Downloading file 5.2.1...
Changed 5 dependencies!
11 packages have newer versions incompatible with dependency constraints.
Try `pub outdated` for more information.

Appending these lines to pubspec.yaml and updating my packages with dart pub get:

dependency_overrides:
  postgres: 2.2.0

Trying run the original command:

$ aqueduct db upgrade --connect postgres://heroes_user:password@localhost:5432/heroes
-- Aqueduct CLI Version: 3.3.0+1
-- Aqueduct project version: 3.3.0+1
*** Uncaught error
    RangeError: Invalid value: Not in inclusive range 0..1114111: -1
  **** Stacktrace
.....

Trying run this command:

$ dart pub run aqueduct db upgrade --connect postgres://heroes_user:password@localhost:5432/heroes
Precompiling executable... (12.4s)
Precompiled aqueduct:aqueduct.
-- Aqueduct CLI Version: 3.3.0+1
-- Aqueduct project version: 3.3.0+1
-- Updating to version 1 on new database...
    PostgreSQL connecting, heroes_user@localhost:5432/heroes.
    Initializating database...
        CREATE TABLE _aqueduct_version_pgsql (versionNumber INT NOT NULL UNIQUE,dateOfUpgrade TIMESTAMP NOT NULL)
    Applying migration version 1...
        CREATE TABLE _Hero (id BIGSERIAL PRIMARY KEY,name TEXT NOT NULL UNIQUE)
    Seeding data from migration version 1...
    Query:execute (4ms) INSERT INTO _Hero (name) VALUES (@name) -> []
    Query:execute (1ms) INSERT INTO _Hero (name) VALUES (@name) -> []
    Query:execute (0ms) INSERT INTO _Hero (name) VALUES (@name) -> []
    Query:execute (0ms) INSERT INTO _Hero (name) VALUES (@name) -> []
    Query:execute (0ms) INSERT INTO _Hero (name) VALUES (@name) -> []
    Applied schema version 1 successfully.

I finally succeeded but... at present I'm using FastAPI.

thanks!!! Working in 2021.

@tbarbette
Copy link

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?

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