itinero / routing-api

An API based on Itinero.
MIT License
13 stars 16 forks source link

500 - Internal Server Error when following quick start tutorial #17

Open georgr opened 5 years ago

georgr commented 5 years ago

I followed the quickstart tutorial from the readme with the switzerland and germany routedb and get a 500 - Internal Server Error when trying to perform a route request.

Following output when starting the server with run.bat:

C:\hyrg_local\projects\router\routing-api-develop\src\Itinero.API>dotnet run [Bootstrapper] information - Loading all routerdb's from path: C:\hyrg_local\projects\router\routerdb\ [Bootstrapper] information - Loading instance germany from: C:\hyrg_local\projects\router\routerdb\germany.a.routerdb [Bootstrapper] information - Loading instance switzerland from: C:\hyrg_local\projects\router\routerdb\switzerland.c.cf.routerdb Hosting environment: Development Content root path: C:\hyrg_local\projects\router\routing-api-develop\src\Itinero.API Now listening on: http://localhost:5000 Application started. Press Ctrl+C to shut down. [Bootstrapper] information - Loaded instance switzerland from: C:\hyrg_local\projects\router\routerdb\switzerland.c.cf.routerdb [RouterBaseExtensions] information - Profile(s) car not cached, building cache. [Bootstrapper] information - Loaded instance germany from: C:\hyrg_local\projects\router\routerdb\germany.a.routerdb

Stacktrace from nancy:

Nancy.RequestExecutionException: Oh noes! ---< System.NullReferenceException: Object reference not set to an instance of an object. at Itinero.Result1.get_Value() at Itinero.API.Instances.Instance.Calculate(String profileName, Coordinate[] coordinates) in C:\hyrglocal\projects\router\routing-api-develop\src\Itinero.API\Instances\Instance.cs:line 132 at Itinero.API.Modules.RoutingModule.DoRouting(Object ) in C:\hyrg_local\projects\router\routing-api-develop\src\Itinero.API\Modules\RoutingModule.cs:line 91 at Itinero.API.Modules.RoutingModule.>.ctor<b00(Object ) in C:\hyrg_local\projects\router\routing-api-develop\src\Itinero.API\Modules\RoutingModule.cs:line 38 at Nancy.NancyModule.><c__DisplayClass14_0`1.>Get<b0(Object args) at Nancy.NancyModule.><c__DisplayClass16_01.>Get<b__0(Object args, CancellationToken ct) at Nancy.Routing.Route1.Invoke(DynamicDictionary parameters, CancellationToken cancellationToken) at Nancy.Routing.DefaultRouteInvoker.>Invoke<d2.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Nancy.Routing.DefaultRequestDispatcher.>Dispatch<d5.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Nancy.NancyEngine.>InvokeRequestLifeCycle<d__22.MoveNext() --- End of inner exception stack trace --- at Nancy.NancyEngine.InvokeOnErrorHook(NancyContext context, ErrorPipeline pipeline, Exception ex)`

The building cache part runs for hours with no result.

Phloog commented 5 years ago

I'm getting this error, too. The line

var result = _router.Router.TryResolve(profile, coordinates[i], 200);

Results in:

result.IsError == true result.ErrorMessage == "Object reference not set to an instance of an object."

Where can I poke next, inside the itinero innards?

Phloog commented 5 years ago

Nevermind - I rebuilt everything (itinero routing, transit and routing-api), but before building I changed the nuget dependencies between them to project-dependencies. That did the trick!

aanddre commented 5 years ago

Nevermind - I rebuilt everything (itinero routing, transit and routing-api), but before building I changed the nuget dependencies between them to project-dependencies. That did the trick!

Hi! I have the same issue. Can you explain a little bit more how you solve it, please-please? I'll really appreciate it.

Phloog commented 5 years ago

Sure, as I said the projects have interdependencies, but those are not set up directly (as project dependencies) but indirectly (e.g. itinero routing-api uses itinero-routing via nuget). I removed the nuget entries referring to the other itinero projects and just added them as ordinary project dependencies for compilation. This way it works (although it's not as flexible/portable and probably not desireable in the long run).