aqueduct icon indicating copy to clipboard operation
aqueduct copied to clipboard

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

Open pratibhashali opened this issue 4 years ago • 24 comments

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

pratibhashali avatar May 20 '20 06:05 pratibhashali

#841 helps

weichengwu avatar May 20 '20 08:05 weichengwu

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

weichengwu avatar May 20 '20 08:05 weichengwu

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.

pratibhashali avatar May 20 '20 08:05 pratibhashali

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.

weichengwu avatar May 20 '20 08:05 weichengwu

flutter version v1.12.13+hotfix.9

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

rodydavis avatar May 20 '20 22:05 rodydavis

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

bambinoua avatar May 26 '20 09:05 bambinoua

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

pratibhashali avatar May 26 '20 10:05 pratibhashali

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

dxps avatar May 27 '20 21:05 dxps

For me I have to switch to flutter stable to run the db migration.

On Wed, May 27, 2020 at 2:39 PM Marius Ileana [email protected] wrote:

@weichengwu https://github.com/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.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/stablekernel/aqueduct/issues/844#issuecomment-634956201, or unsubscribe https://github.com/notifications/unsubscribe-auth/AHOOFX3A3IL7GVVLZ2MXGN3RTWCAZANCNFSM4NFUTIHQ .

-- Rody Davis Jr

rodydavis avatar May 28 '20 00:05 rodydavis

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.

edufolly avatar May 28 '20 14:05 edufolly

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 avatar Jun 01 '20 20:06 dxps

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

dxps avatar Jun 02 '20 19:06 dxps

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!

Dshosev avatar Jul 01 '20 18:07 Dshosev

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

Terterola avatar Aug 04 '20 01:08 Terterola

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.

warcayac avatar Nov 18 '20 00:11 warcayac

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?

rdnobrega avatar Nov 22 '20 19:11 rdnobrega

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 avatar Nov 23 '20 14:11 HasseneKh

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

HasseneKh avatar Nov 23 '20 15:11 HasseneKh

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 <[email protected]>

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

KuuBee avatar Nov 24 '20 03:11 KuuBee

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 <[email protected]>

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.

warcayac avatar Nov 24 '20 14:11 warcayac

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.. https://github.com/stablekernel/aqueduct/issues/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.

vinnytwice avatar Jan 06 '21 10:01 vinnytwice

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 <[email protected]>

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!

gonzalonm avatar Jan 28 '21 17:01 gonzalonm

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 <[email protected]>

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.

fabioselau077 avatar Feb 08 '21 04:02 fabioselau077

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?

tbarbette avatar Feb 17 '21 21:02 tbarbette