Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Internal Server Error" when clicking on Statistics #383

Closed
nrevolt opened this issue Jan 6, 2025 · 3 comments
Closed

"Internal Server Error" when clicking on Statistics #383

nrevolt opened this issue Jan 6, 2025 · 3 comments

Comments

@nrevolt
Copy link

nrevolt commented Jan 6, 2025

Upgraded to most current version on Jan 5, 2025 and now when I click on Statistics I get the following error: {"message":"Internal Server Error"}

Tried updating to most current release branch master (25e0cf9), and problem persists

Log shows the following:

{
"time": "2025-01-06T15:27:56.85865377-05:00",
"level": "-",
"prefix": "echo",
"file": "recover.go",
"line": "119",
"message": "[PANIC RECOVER] runtime error: invalid memory address or nil pointer dereference goroutine 75 [running]:\ngithub.com/jovandeginste/workout-tracker/pkg/app.newEcho.Recover.RecoverWithConfig.func2.1.1()\n\t/app/vendor/github.com/labstack/echo/v4/middleware/recover.go:99 +0x156\npanic({0xf3a1a0?, 0x2630e40?})\n\t/usr/local/go/src/runtime/panic.go:785 +0x132\ngithub.com/invopop/ctxi18n/i18n.GetLocale(...)\n\t/app/vendor/github.com/invopop/ctxi18n/i18n/locale.go:92\ngithub.com/invopop/ctxi18n.Locale(...)\n\t/app/vendor/github.com/invopop/ctxi18n/ctxi18n.go:73\ngithub.com/jovandeginste/workout-tracker/pkg/database.(*User).GetTranslator(0xc00b47f530?)\n\t/app/pkg/database/user.go:69 +0x16\ngithub.com/jovandeginste/workout-tracker/pkg/database.(*User).I18n(0xc0002ee140?, {0xc000cadf10, 0x7}, {0x0, 0x0, 0x0})\n\t/app/pkg/database/user.go:65 +0x2c\ngithub.com/jovandeginste/workout-tracker/pkg/database.(*User).GetStatistics(0xc00027da40, {{0x1065854, 0x6}, {0x10645cf, 0x5}})\n\t/app/pkg/database/statistics.go:126 +0x7ce\ngithub.com/jovandeginste/workout-tracker/pkg/database.(*User).GetStatisticsFor(0x14e9a30?, {0x1065854?, 0xc00b47e4e0?}, {0x10645cf?, 0xc0005e6f90?})\n\t/app/pkg/database/statistics.go:76 +0x1d\ngithub.com/jovandeginste/workout-tracker/pkg/app.(*App).statisticsHandler.Statistics.func1({{0x14e9a30?, 0xc00b47e000?}, {0x14deec0?, 0xc00b47e120?}})\n\t/app/views/user/statistics_templ.go:340 +0x212c\ngithub.com/jovandeginste/workout-tracker/pkg/app.(*App).statisticsHandler.Statistics.GeneratedTemplate.func2({0x14e9a30?, 0xc00b47e000?}, {0x14deec0?, 0xc00b47e120?})\n\t/app/vendor/github.com/a-h/templ/runtime/runtime.go:19 +0x2b\ngithub.com/a-h/templ.ComponentFunc.Render(0x2640720?, {0x14e9a30?, 0xc00b47e000?}, {0x14deec0?, 0xc00b47e120?})\n\t/app/vendor/github.com/a-h/templ/runtime.go:36 +0x37\ngithub.com/jovandeginste/workout-tracker/pkg/app.Render({0x14fcac0, 0xc000c93530}, 0xc8, {0x14defa0, 0xc000c93bd0})\n\t/app/pkg/app/handlers.go:113 +0xee\ngithub.com/jovandeginste/workout-tracker/pkg/app.(*App).statisticsHandler(0xc000471a40, {0x14fcac0, 0xc000c93530})\n\t/app/pkg/app/handlers.go:45 +0x1ac\ngithub.com/jovandeginste/workout-tracker/pkg/app.(*App).ValidateUserMiddleware-fm.(*App).ValidateUserMiddleware.func1({0x14fcac0, 0xc000c93530})\n\t/app/pkg/app/routes.go:104 +0x112\ngithub.com/labstack/echo-jwt/v4.Config.ToMiddleware.func2.1({0x14fcac0, 0xc000c93530})\n\t/app/vendor/github.com/labstack/echo-jwt/v4/jwt.go:237 +0x43c\ngithub.com/labstack/echo/v4.(*Echo).add.func1({0x14fcac0, 0xc000c93530})\n\t/app/vendor/github.com/labstack/echo/v4/echo.go:581 +0x4b\ngithub.com/jovandeginste/workout-tracker/pkg/app.(*App).ContextValueMiddleware-fm.(*App).ContextValueMiddleware.func1({0x14fcc90?, 0xc000301400?})\n\t/app/pkg/app/routes.go:163 +0x50\ngithub.com/jovandeginste/workout-tracker/pkg/app.(*App).ConfigureWebserver.LoadAndSave.LoadAndSaveWithConfig.func2.1({0x14fcc90, 0xc000301400})\n\t/app/vendor/github.com/spazzymoto/echo-scs-session/session.go:90 +0x1cb\ngithub.com/labstack/echo/v4/middleware.GzipWithConfig.func1.1({0x14fcc90, 0xc000301400})\n\t/app/vendor/github.com/labstack/echo/v4/middleware/compress.go:139 +0x2a2\ngithub.com/labstack/echo/v4/middleware.CORSWithConfig.func1.1({0x14fcc90, 0xc000301400})\n\t/app/vendor/github.com/labstack/echo/v4/middleware/cors.go:215 +0x482\ngithub.com/jovandeginste/workout-tracker/pkg/app.newEcho.Secure.SecureWithConfig.func3.1({0x14fcc90, 0xc000301400})\n\t/app/vendor/github.com/labstack/echo/v4/middleware/secure.go:141 +0x364\ngithub.com/jovandeginste/workout-tracker/pkg/app.newEcho.Recover.RecoverWithConfig.func2.1({0x14fcc90, 0xc000301400})\n\t/app/vendor/github.com/labstack/echo/v4/middleware/recover.go:130 +0x114\ngithub.com/jovandeginste/workout-tracker/pkg/app.newEcho.New.NewWithConfig.func1.1({0x14fcc90, 0xc000301400})\n\t/app/vendor/github.com/samber/slog-echo/middleware.go:127 +0x2ec\ngithub.com/labstack/echo/v4.(*Echo).ServeHTTP.func1({0x14fcc90, 0xc000301400})\n\t/app/vendor/github.com/labstack/echo/v4/echo.go:662 +0x127\ngithub.com/jovandeginste/workout-tracker/pkg/app.newEcho.RemoveTrailingSlash.RemoveTrailingSlashWithConfig.func4.1({0x14fcc90, 0xc000301400})\n\t/app/vendor/github.com/labstack/echo/v4/middleware/slash.go:1\n"
}

@jovandeginste
Copy link
Owner

Apologies; fixed in master!

@nrevolt
Copy link
Author

nrevolt commented Jan 6, 2025

Wow, that was a quick turn around. Thanks.

@jovandeginste
Copy link
Owner

I had just hit the bug myself, so I was already working on it :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants