~netlandish/links#78: 
getPaymentHistory call: GraphQL query error: runtime error: invalid memory address or nil pointer dereference

Seems to happen when requesting payment history for an org that is free

Error occured processing GraphQL request:

runtime error: invalid memory address or nil pointer dereference

When running the following query on behalf of contact@XXXXX.com:

query GetPaymentHistory($orgSlug: String, $after: Cursor, $before: Cursor) {
                        getPaymentHistory(input: {
                                orgSlug: $orgSlug
                                after: $after,
                                before: $before,
                        }) {
                                result {
                                        id
                                        amount
                                        amountRefunded
                                        hostedInvoiceURL
                                        createdOn
                                }
                                pageInfo {
                                        cursor
                                        hasPrevPage
                                        hasNextPage
                                }
                        }
                }

With these variables:

{"orgSlug":"XXXXX"}

Attempted to collect final caller:

/home/links/links/api/graph/generated.go:16190

The following stack trace was produced:

goroutine 1318 [running]:
netlandish.com/x/gobwebs/server.(*Server).gqlEmailRecover(0x854303720, {0x17ddc00, 0x85473d440}, {0x1126c80?, 0x1f91370?})
        /home/links/go/pkg/mod/netlandish.com/x/gobwebs@v0.0.0-20240425224212-784ef6266c55/server/server.go:288 +0x1b3
github.com/99designs/gqlgen/graphql.(*OperationContext).Recover(0x85467cc60?, {0x17ddc00, 0x85473d440}, {0x1126c80?, 0x1f91370?})
        /home/links/go/pkg/mod/github.com/99designs/gqlgen@v0.17.29/graphql/context_operation.go:124 +0x3e
links/api/graph.(*executionContext)._Query_getPaymentHistory.func1()
        /home/links/links/api/graph/generated.go:16190 +0x6a
panic({0x1126c80, 0x1f91370})
        /usr/local/go120/src/runtime/panic.go:884 +0x213
links/models.(*Organization).permCheck(0x17ddc00?, {0x17ddc00?, 0x85473d440?}, 0x6?, 0x0?)
        /home/links/links/models/organization.go:218 +0x36
links/models.(*Organization).CanRead(...)
        /home/links/links/models/organization.go:239
links/api/graph.(*queryResolver).GetPaymentHistory(0x111de60?, {0x17ddc00?, 0x85473d440}, 0x5?)
        /home/links/links/api/graph/schema.resolvers.go:4350 +0x387
links/api/graph.(*executionContext)._Query_getPaymentHistory.func2.1({0x17ddc00?, 0x85473d440})
        /home/links/links/api/graph/generated.go:16197 +0xc4
links/api/directives.Access({0x17ddc00, 0x85473d440}, {0xe48a53?, 0x17ddc00?}, 0x8541d0fc0, {0x125a7d6, 0x7}, {0x124e87c, 0x2})
        /home/links/links/api/directives/directives.go:66 +0x2a9
main.run.func1({0x17ddc00?, 0x85473d440?}, {0x0?, 0x0?}, 0x17d2de0?, {0x125a7d6?, 0x8541d0fc0?}, {0x124e87c?, 0x854610738?})
        /home/links/links/cmd/api/main.go:97 +0x3d
links/api/graph.(*executionContext)._Query_getPaymentHistory.func2.2({0x17ddc00, 0x85473d440})
        /home/links/links/api/graph/generated.go:16211 +0xd7
links/api/graph.(*executionContext)._Query_getPaymentHistory.func2({0x17ddc00, 0x85473d440})
        /home/links/links/api/graph/generated.go:16214 +0xe4
github.com/99designs/gqlgen/graphql/executor.processExtensions.func4({0x17ddc00?, 0x85473d440?}, 0x854414150?)
        /home/links/go/pkg/mod/github.com/99designs/gqlgen@v0.17.29/graphql/executor/extensions.go:72 +0x26
links/api/graph.(*executionContext)._Query_getPaymentHistory(0x854768410, {0x17ddc00, 0x85473d290}, {0x8544fa080?, {0x8541d0e60?, 0x85474a6e0?, 0x854610930?}})
        /home/links/links/api/graph/generated.go:16194 +0x219
links/api/graph.(*executionContext)._Query.func19({0x17ddc00?, 0x85473d290?})
        /home/links/links/api/graph/generated.go:25772 +0xae
github.com/99designs/gqlgen/graphql/executor.processExtensions.func3({0x17ddc00?, 0x85473d290?}, 0x10?)
        /home/links/go/pkg/mod/github.com/99designs/gqlgen@v0.17.29/graphql/executor/extensions.go:69 +0x26
links/api/graph.(*executionContext)._Query.func20({0x17ddc00?, 0x85473d290?})
        /home/links/links/api/graph/generated.go:25780 +0x32
links/api/graph.(*executionContext)._Query.func21()
        /home/links/links/api/graph/generated.go:25784 +0x25
github.com/99designs/gqlgen/graphql.(*FieldSet).Dispatch(0x8546344b0)
        /home/links/go/pkg/mod/github.com/99designs/gqlgen@v0.17.29/graphql/fieldset.go:34 +0x8e
links/api/graph.(*executionContext)._Query(0x854768410, {0x17ddc00, 0x85473d200}, {0x854768170, 0x1, 0x1})
        /home/links/links/api/graph/generated.go:26259 +0x4c85
links/api/graph.(*executableSchema).Exec.func1({0x17ddc00?, 0x85473d1d0?})
        /home/links/links/api/graph/generated.go:2594 +0x93
github.com/99designs/gqlgen/graphql/executor.(*Executor).DispatchOperation.func1.1.1({0x17ddc00, 0x85473d1d0})
        /home/links/go/pkg/mod/github.com/99designs/gqlgen@v0.17.29/graphql/executor/executor.go:119 +0x2b
github.com/99designs/gqlgen/graphql/executor.processExtensions.func2({0x17ddc00?, 0x85473d1d0?}, 0x10c7620?)
        /home/links/go/pkg/mod/github.com/99designs/gqlgen@v0.17.29/graphql/executor/extensions.go:66 +0x26
github.com/99designs/gqlgen/graphql/executor.(*Executor).DispatchOperation.func1.1({0x17ddc00, 0x85473d110})
        /home/links/go/pkg/mod/github.com/99designs/gqlgen@v0.17.29/graphql/executor/executor.go:118 +0x113
github.com/99designs/gqlgen/graphql/handler/transport.POST.Do({0x17ddc00?}, {0x17dc560?, 0x854702480}, 0x854704500, {0x17dc2c0, 0x85421e6e0})
        /home/links/go/pkg/mod/github.com/99designs/gqlgen@v0.17.29/graphql/handler/transport/http_post.go:91 +0x504
github.com/99designs/gqlgen/graphql/handler.(*Server).ServeHTTP(0x85446c8e0, {0x17dc560, 0x854702480}, 0x854704500)
        /home/links/go/pkg/mod/github.com/99designs/gqlgen@v0.17.29/graphql/handler/server.go:121 +0x273
netlandish.com/x/gobwebs/server.(*Server).WithSchema.func2({0x17f06b8, 0x85473cb10})
        /home/links/go/pkg/mod/netlandish.com/x/gobwebs@v0.0.0-20240425224212-784ef6266c55/server/server.go:536 +0x1a9
github.com/labstack/echo/v4.(*Echo).add.func1({0x17f06b8, 0x85473cb10})
        /home/links/go/pkg/mod/github.com/labstack/echo/v4@v4.11.4/echo.go:582 +0x51
links/core.InternalAuthMiddleware.func1.1({0x17f06b8, 0x85473cb10})
        /home/links/links/core/middleware.go:78 +0x408
netlandish.com/x/gobwebs/crypto.Middleware.func1.1({0x17f06b8, 0x85473cb10})
        /home/links/go/pkg/mod/netlandish.com/x/gobwebs@v0.0.0-20240425224212-784ef6266c55/crypto/middleware.go:47 +0xe6
links/core.TimezoneContext.func1.1({0x17f06b8, 0x85473cb10})
        /home/links/links/core/middleware.go:23 +0x195
links/api/loaders.Middleware.func1.1({0x17f06b8, 0x85473cb10})
        /home/links/links/api/loaders/middlerare.go:21 +0x166
netlandish.com/x/gobwebs/database.Middleware.func1.1({0x17f06b8, 0x85473cb10})
        /home/links/go/pkg/mod/netlandish.com/x/gobwebs@v0.0.0-20240425224212-784ef6266c55/database/sql.go:80 +0xb8
github.com/labstack/echo/v4/middleware.CSRFWithConfig.func1.1({0x17f06b8, 0x85473cb10})
        /home/links/go/pkg/mod/github.com/labstack/echo/v4@v4.11.4/middleware/csrf.go:130 +0x196
github.com/labstack/echo/v4/middleware.RequestIDWithConfig.func1.1({0x17f06b8, 0x85473cb10})
        /home/links/go/pkg/mod/github.com/labstack/echo/v4@v4.11.4/middleware/request_id.go:69 +0x1cc
github.com/labstack/echo/v4/middleware.LoggerWithConfig.func2.1({0x17f06b8, 0x85473cb10})
        /home/links/go/pkg/mod/github.com/labstack/echo/v4@v4.11.4/middleware/logger.go:126 +0xe2
github.com/labstack/echo/v4/middleware.RecoverWithConfig.func1.1({0x17f06b8, 0x85473cb10})
        /home/links/go/pkg/mod/github.com/labstack/echo/v4@v4.11.4/middleware/recover.go:131 +0x131
netlandish.com/x/gobwebs/server.Middleware.func1.1({0x17f06b8, 0x85473cb10})
        /home/links/go/pkg/mod/netlandish.com/x/gobwebs@v0.0.0-20240425224212-784ef6266c55/server/middleware.go:36 +0x173
netlandish.com/x/gobwebs/server.(*Server).DefaultMiddlewareWithConfig.func1.1({0x17f04e8?, 0x854486320})
        /home/links/go/pkg/mod/netlandish.com/x/gobwebs@v0.0.0-20240425224212-784ef6266c55/server/server.go:588 +0x9a
github.com/labstack/echo/v4.(*Echo).ServeHTTP(0x8546c8480, {0x17dcf80?, 0x8544a4540}, 0x854704200)
        /home/links/go/pkg/mod/github.com/labstack/echo/v4@v4.11.4/echo.go:669 +0x3d1
net/http.serverHandler.ServeHTTP({0x17da9f0?}, {0x17dcf80, 0x8544a4540}, 0x854704200)
        /usr/local/go120/src/net/http/server.go:2936 +0x316
net/http.(*conn).serve(0x8546dc120, {0x17ddc00, 0x854518870})
        /usr/local/go120/src/net/http/server.go:1995 +0x612
created by net/http.(*Server).Serve
        /usr/local/go120/src/net/http/server.go:3089 +0x5ed
Status
REPORTED
Submitter
~petersanchez
Assigned to
No-one
Submitted
5 months ago
Updated
5 months ago
Labels
bug graphql

~petersanchez 5 months ago

I'm not able to reproduce it and also asked the user who initially saw this error try again and it's working as expected.

Register here or Log in to comment, or comment via email.