diff --git a/runtime/wasmhost/wasmhost.go b/runtime/wasmhost/wasmhost.go index 6fbf774c..55e8ca78 100644 --- a/runtime/wasmhost/wasmhost.go +++ b/runtime/wasmhost/wasmhost.go @@ -19,6 +19,7 @@ import ( "github.com/hypermodeinc/modus/runtime/logger" "github.com/hypermodeinc/modus/runtime/middleware" "github.com/hypermodeinc/modus/runtime/plugins" + "github.com/hypermodeinc/modus/runtime/timezones" "github.com/hypermodeinc/modus/runtime/utils" "github.com/rs/zerolog" @@ -112,7 +113,12 @@ func (host *wasmHost) GetModuleInstance(ctx context.Context, plugin *plugins.Plu wErr := io.MultiWriter(buffers.StdErr(), wErrorLog) // Get the time zone to pass to the module instance. - tz := ctx.Value(utils.TimeZoneContextKey).(string) + var timeZone string + if tz, ok := ctx.Value(utils.TimeZoneContextKey).(string); ok { + timeZone = tz + } else { + timeZone = timezones.GetLocalTimeZone() + } // Configure the module instance. // Note, we use an anonymous module name (empty string) here, @@ -126,7 +132,7 @@ func (host *wasmHost) GetModuleInstance(ctx context.Context, plugin *plugins.Plu WithSysWalltime().WithSysNanotime(). WithRandSource(rand.Reader). WithStdout(wOut).WithStderr(wErr). - WithEnv("TZ", tz). + WithEnv("TZ", timeZone). WithEnv("CLAIMS", jwtClaims) // Instantiate the plugin as a module.