Skip to content

Private-only service causes gateway to panic #2224

@marcwickenden

Description

@marcwickenden

When self-hosting I build two docker images. One with --gateways= to not include the api-gateway. The second with --gateways=api-gateway to include this.

Among my services there is one called email which contains a single private func SendMail used by various Encore services. It should not, as the name suggests, be used publicly and therefore does not need to be in the gateway.

When the gateway starts it errored like this:

panic: service "email" not found in service discovery when hosted in gateway

goroutine 1 [running]:
encore.dev/appruntime/apisdk/api.(*Server).createGatewayHandlerAdapter(0xc0006c5dc0, {0x309fdf8, 0x4889040})
        /home/runner/.encore/runtimes/go/appruntime/apisdk/api/gateway.go:29 +0x774
encore.dev/appruntime/apisdk/api.(*Server).registerEndpoint(0xc0006c5dc0, {0x309fdf8, 0x4889040}, {0x24b7aa0, 0x2d55a38})
        /home/runner/.encore/runtimes/go/appruntime/apisdk/api/server.go:334 +0x1c5
encore.dev/appruntime/apisdk/api.RegisterEndpoint(...)
        /home/runner/.encore/runtimes/go/appruntime/apisdk/api/registry.go:8
encore.app/email.init.0()
        /home/runner/work/hub/hub/backend/email/encore_internal__api.go:14 +0x36

This appeared to relate to service discovery definitions being built for gateway including private services too.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions