-
Notifications
You must be signed in to change notification settings - Fork 547
Closed
Description
Description
During testing an endpoint, there is a unrecoverable panic thrown by the encore runtime.ts.
Details
Encore Daemon Env
ENCORE_GOROOT=/opt/homebrew/Cellar/encore/1.48.10/libexec/encore-go
ENCORE_RUNTIMES_PATH=/opt/homebrew/Cellar/encore/1.48.10/libexec/runtimes
ENCORE_RUNTIME_LIB=/opt/homebrew/Cellar/encore/1.48.10/libexec/runtimes/js/encore-runtime.node
ENCORE_DAEMON_LOG_PATH=/Users/Clayton/Library/Caches/encore/daemon.log
Stack Trace
panic: runtime error: slice bounds out of range [:3] with length 2
goroutine 46 [running]:
github.com/rs/zerolog.ConsoleWriter.writePart.consoleDefaultFormatLevel.func1({0x1034bae20?, 0x14000aaa2a0?})
github.com/rs/zerolog@v1.31.0/console.go:403 +0x3b4
github.com/rs/zerolog.ConsoleWriter.writePart({{0x1038e9ce0, 0x1400087a690}, 0x0, {0x10293d8a1, 0x6}, {0x14000f0a800, 0x4, 0x4}, {0x0, 0x0, ...}, ...}, ...)
github.com/rs/zerolog@v1.31.0/console.go:293 +0x23c
github.com/rs/zerolog.ConsoleWriter.Write({{0x1038e9ce0, 0x1400087a690}, 0x0, {0x10293d8a1, 0x6}, {0x14000f0a800, 0x4, 0x4}, {0x0, 0x0, ...}, ...}, ...)
github.com/rs/zerolog@v1.31.0/console.go:128 +0x38c
encr.dev/cli/cmd/encore/cmdutil.ConvertJSONLogs.func2({0x14000bb9000, 0x2cd, 0x1000})
encr.dev/cli/cmd/encore/cmdutil/stream.go:164 +0x14c
encr.dev/cli/cmd/encore/cmdutil.StreamCommandOutput.func3()
encr.dev/cli/cmd/encore/cmdutil/stream.go:63 +0x19c
created by encr.dev/cli/cmd/encore/cmdutil.StreamCommandOutput in goroutine 1
encr.dev/cli/cmd/encore/cmdutil/stream.go:56 +0x268
Reproduce
Minimal service to reproduce:
export const errorEndpoint = api(
{ method: "GET", path: "/api/trigger" },
async (): Promise<{ok: boolean}> => {
const permitClient = new Permit({token: "***", pdp: "https://cloudpdp.api.permit.io"});
const userResult = await permit.api.users.create({
key: 'test-uuid'
email: 'test@gmail.com',
attributes: {},
})
return { ok: true };
});The issue is only triggered once the call to await permit.api.users.create({...}) fails. Using a duplicate key to create a resource is an easy trigger.
Links
Metadata
Metadata
Assignees
Labels
No labels