diff --git a/CHANGELOG.md b/CHANGELOG.md index 77a9ddf795a8210c461fabfd360a6fe405315e64..b671c7199f77885162d451ac91d9afde689a1480 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,6 +19,8 @@ The format is based on [keep a changelog](http://keepachangelog.com) and this pr - Better handling of storage operations where OCC is not required. - Default ledger updates to false in JS and Lua runtimes `walletsUpdate` functions. - Build with Go 1.17.0 release. +- New config option to toggle Lua runtime error stacktraces returned to clients. +- Purchase validation functions now return a flag indicating if valid purchases are new or resubmitted. ### Fixed - Fix log level in Lua runtime log calls which use logger fields. diff --git a/server/config.go b/server/config.go index 377a86da4e97df81563d61e288b0863c944ff95b..1f6e97895d2367d1eac7ba094ced12b9d852607c 100644 --- a/server/config.go +++ b/server/config.go @@ -765,7 +765,7 @@ type RuntimeConfig struct { EventQueueWorkers int `yaml:"event_queue_workers" json:"event_queue_workers" usage:"Number of workers to use for concurrent processing of events. Default 8."` ReadOnlyGlobals bool `yaml:"read_only_globals" json:"read_only_globals" usage:"When enabled marks all Lua runtime global tables as read-only to reduce memory footprint. Default true."` // Kept for backwards compatibility LuaReadOnlyGlobals bool `yaml:"lua_read_only_globals" json:"lua_read_only_globals" usage:"When enabled marks all Lua runtime global tables as read-only to reduce memory footprint. Default true."` - LuaApiStackTrace bool `yaml:"lua_api_stacktrace" json:"lua_api_stacktrace" usage:"Add the Lua stacktrace in the API response"` + LuaApiStacktrace bool `yaml:"lua_api_stacktrace" json:"lua_api_stacktrace" usage:"Include the Lua stacktrace in error responses returned to the client. Default false."` JsEntrypoint string `yaml:"js_entrypoint" json:"js_entrypoint" usage:"Specifies the location of the bundled JavaScript runtime source code."` } @@ -826,7 +826,7 @@ func NewRuntimeConfig() *RuntimeConfig { EventQueueWorkers: 8, ReadOnlyGlobals: true, LuaReadOnlyGlobals: true, - LuaApiStackTrace: true, + LuaApiStacktrace: false, } } diff --git a/server/runtime_lua.go b/server/runtime_lua.go index 097fe1e2d3482d5f3c6c4e7354e0c39171f7ef84..2a2fe212f9383b75212482cfeb2a417ef03ca51f 100644 --- a/server/runtime_lua.go +++ b/server/runtime_lua.go @@ -36,7 +36,6 @@ import ( "github.com/heroiclabs/nakama/v3/social" "go.uber.org/atomic" "go.uber.org/zap" - "go.uber.org/zap/zapcore" "google.golang.org/grpc/codes" "google.golang.org/protobuf/encoding/protojson" "google.golang.org/protobuf/proto" @@ -2004,9 +2003,7 @@ func (r *RuntimeLua) Stop() { } func clearFnError(fnErr error, rp *RuntimeProviderLua, lf *lua.LFunction) error { - if apiErr, ok := fnErr.(*lua.ApiError); ok && - (!rp.config.GetRuntime().LuaApiStackTrace || !rp.logger.Core().Enabled(zapcore.InfoLevel)) { - + if apiErr, ok := fnErr.(*lua.ApiError); ok && !rp.config.GetRuntime().LuaApiStacktrace { msg := apiErr.Object.String() if strings.HasPrefix(msg, lf.Proto.SourceName) { msg = msg[len(lf.Proto.SourceName):]