Skip to content

New endpoints added during serverpod start aren't available in the Flutter app until a hot restart #6047

Backlog

Description

@Roxie-32

Describe the bug

When a new endpoint is added while serverpod start is running, the runner regenerates the client and hot reloads the server and the Flutter app. Calling the new endpoint from the app then fails on the client with a LateInitializationError. The call only works after a hot restart (R).

To reproduce

  1. Create a project with serverpod create and run serverpod start with the Flutter app open.
  2. Add a new endpoint to the server, for example lib/src/greetings/ping_endpoint.dart:
    class PingEndpoint extends Endpoint {
      Future<Greeting> hello(Session session, String name) async {
        return Greeting(message: 'Pong $name', author: 'Ping', timestamp: DateTime.now());
      }
    }
  3. In the Flutter app, call the new endpoint, for example by changing client.greeting.hello(...) to client.ping.hello(...) in greetings_screen.dart.
  4. Save and trigger the call in the app without pressing R.

Expected behavior

The new endpoint can be called after the automatic reload.

Library version

Serverpod CLI: 4.1.2

Platform information

Macos

Additional context

No response

How experienced are you with this library?

None

Are you interested in working on a PR for this?

  • I want to work on this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions