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

Button "Scan All" fails: GraphQL error: internal system error #26

Closed
SlavikCA opened this issue Apr 14, 2020 · 2 comments · Fixed by #30
Closed

Button "Scan All" fails: GraphQL error: internal system error #26

SlavikCA opened this issue Apr 14, 2020 · 2 comments · Fixed by #30
Labels
API Related to the backend api server written in Go good first issue Good for newcomers

Comments

@SlavikCA
Copy link
Contributor

SlavikCA commented Apr 14, 2020

I followed README to install system from scratch via Docker.
It started.

Result:

  • Nothing is scanned
  • Error in the browser console:
    Request URL: http://localhost:8000/api/graphql
    Request Method: POST
    Request Payload: {"operationName":"scanAllMutation","variables":{},"query":"mutation scanAllMutation {\n scanAll {\n success\n message\n __typename\n }\n}\n"}

Response Status Code: 200 OK
Response: {"errors":[{"message":"internal system error","path":["scanAll"]}],"data":null}

Browser error:

apolloClient.js:55
[GraphQL error]: Message: internal system error, Location: undefined Path: scanAll

ApolloError.ts:57 Uncaught (in promise) Error: GraphQL error: internal system error
at new r (ApolloError.ts:57)
at Object.next (QueryManager.ts:225)
at p (Observable.js:130)
at d (Observable.js:165)
at n.value (Observable.js:219)
at observables.ts:12
at Set.forEach ()
at Object.next (observables.ts:12)
at p (Observable.js:130)
at d (Observable.js:165)

Docker log:
Not implemented

goroutine 1536 [running]:
runtime/debug.Stack(0x1, 0x0, 0x0)
/usr/local/go/src/runtime/debug/stack.go:24 +0x9d
runtime/debug.PrintStack()
/usr/local/go/src/runtime/debug/stack.go:16 +0x22
github.com/99designs/gqlgen/graphql.DefaultRecover(0xae9840, 0xc000744c90, 0x94e160, 0xad2930, 0x3ca40, 0xeb8080)
/go/pkg/mod/github.com/99designs/gqlgen@v0.11.2/graphql/recovery.go:16 +0xa7
github.com/viktorstrate/photoview/api/graphql.(*executionContext)._Mutation_scanAll.func1(0xc0003342e0, 0xc000334330, 0xc000269058)
/app/graphql/generated.go:2345 +0x78
panic(0x94e160, 0xad2930)
/usr/local/go/src/runtime/panic.go:969 +0x166
github.com/viktorstrate/photoview/api/graphql/resolvers.(*mutationResolver).ScanAll(0xc0001a6bb0, 0xae9840, 0xc000744c90, 0xe79230, 0x9847e0, 0xc0008f8480)
/app/graphql/resolvers/scanner.go:12 +0x39
github.com/viktorstrate/photoview/api/graphql.(*executionContext)._Mutation_scanAll.func2.1(0xae9840, 0xc000744c90, 0xe79230, 0x9847e0, 0xc0008f8480, 0x7efc65a027d0)
/app/graphql/generated.go:2360 +0x82
github.com/viktorstrate/photoview/api/graphql.IsAdmin.func1(0xae9840, 0xc000744c90, 0x0, 0x0, 0xc00035ce00, 0x20, 0x9b0760, 0xc000268f01, 0xc00035ce00)
/app/graphql/directive.go:20 +0xdc
github.com/viktorstrate/photoview/api/graphql.(*executionContext)._Mutation_scanAll.func2.2(0xae9840, 0xc000744c90, 0x30, 0x9d54c0, 0x18, 0x18)
/app/graphql/generated.go:2366 +0x5d
github.com/viktorstrate/photoview/api/graphql.(*executionContext)._Mutation_scanAll.func2(0xae9840, 0xc000744c90, 0x20, 0x9b0760, 0xae9801, 0xc00035cdc0)
/app/graphql/generated.go:2369 +0xbd
github.com/99designs/gqlgen/graphql/executor.processExtensions.func3(0xae9840, 0xc000744c90, 0xc00035cdc0, 0xae9840, 0xc000744c90, 0x7efc65a027d0, 0x0)
/go/pkg/mod/github.com/99designs/gqlgen@v0.11.2/graphql/executor/extensions.go:62 +0x3a
github.com/viktorstrate/photoview/api/graphql.(*executionContext)._Mutation_scanAll(0xc0003342e0, 0xae9840, 0xc000744c60, 0xc00038dc80, 0xc000744c30, 0x3, 0x3, 0x0, 0x0)
/app/graphql/generated.go:2357 +0x1e0
github.com/viktorstrate/photoview/api/graphql.(*executionContext)._Mutation(0xc0003342e0, 0xae9840, 0xc000744c60, 0xc00001e5f0, 0x1, 0x1, 0x40c3f6, 0xc000744c00)
/app/graphql/generated.go:6299 +0x374
github.com/viktorstrate/photoview/api/graphql.(*executableSchema).Exec.func2(0xae9840, 0xc000744c00, 0x10)
/app/graphql/generated.go:996 +0x7b
github.com/99designs/gqlgen/graphql/executor.(*Executor).DispatchOperation.func1.1.1(0xae9840, 0xc000744c00, 0xc0003342f0)
/go/pkg/mod/github.com/99designs/gqlgen@v0.11.2/graphql/executor/executor.go:105 +0x43
github.com/99designs/gqlgen/graphql/executor.processExtensions.func2(0xae9840, 0xc000744c00, 0xc0003342f0, 0xad2470)
/go/pkg/mod/github.com/99designs/gqlgen@v0.11.2/graphql/executor/extensions.go:59 +0x3a
github.com/99designs/gqlgen/graphql/executor.(*Executor).DispatchOperation.func1.1(0xae9840, 0xc000744b10, 0xc000744990)
/go/pkg/mod/github.com/99designs/gqlgen@v0.11.2/graphql/executor/executor.go:104 +0x12a
github.com/99designs/gqlgen/graphql/handler/transport.POST.Do(0xae7d80, 0xc0007448d0, 0xc0001fe700, 0xae7c00, 0xc0001ca120)
/go/pkg/mod/github.com/99designs/gqlgen@v0.11.2/graphql/handler/transport/http_post.go:52 +0x353
github.com/99designs/gqlgen/graphql/handler.(*Server).ServeHTTP(0xc0001bc720, 0xae7d80, 0xc0007448d0, 0xc0001fe700)
/go/pkg/mod/github.com/99designs/gqlgen@v0.11.2/graphql/handler/server.go:115 +0x1fd
net/http.HandlerFunc.ServeHTTP(0xc0001a2580, 0xae7d80, 0xc0007448d0, 0xc0001fe300)
/usr/local/go/src/net/http/server.go:2012 +0x44
github.com/viktorstrate/photoview/api/server.CORSMiddleware.func1.1(0xae7d80, 0xc0007448d0, 0xc0001fe300)
/app/server/cors_middleware.go:37 +0x7b1
net/http.HandlerFunc.ServeHTTP(0xc0001210a0, 0xae7d80, 0xc0007448d0, 0xc0001fe300)
/usr/local/go/src/net/http/server.go:2012 +0x44
github.com/viktorstrate/photoview/api/server.LoggingMiddleware.func1(0xae8400, 0xc0003ea7e0, 0xc0001fe300)
/app/server/logging.go:20 +0x152
net/http.HandlerFunc.ServeHTTP(0xc0001210c0, 0xae8400, 0xc0003ea7e0, 0xc0001fe300)
/usr/local/go/src/net/http/server.go:2012 +0x44
github.com/viktorstrate/photoview/api/graphql/auth.Middleware.func1.1(0xae8400, 0xc0003ea7e0, 0xc000107c00)
/app/graphql/auth/auth.go:55 +0x2d5
net/http.HandlerFunc.ServeHTTP(0xc0001210e0, 0xae8400, 0xc0003ea7e0, 0xc000107c00)
/usr/local/go/src/net/http/server.go:2012 +0x44
github.com/gorilla/mux.(*Router).ServeHTTP(0xc0002b8000, 0xae8400, 0xc0003ea7e0, 0xc0001fe200)
/go/pkg/mod/github.com/gorilla/mux@v1.7.4/mux.go:210 +0xe2
net/http.serverHandler.ServeHTTP(0xc0002c40e0, 0xae8400, 0xc0003ea7e0, 0xc0001fe200)
/usr/local/go/src/net/http/server.go:2807 +0xa3
net/http.(*conn).serve(0xc0002bb360, 0xae9780, 0xc0005fcc00)
/usr/local/go/src/net/http/server.go:1895 +0x86c
created by net/http.(*Server).Serve
/usr/local/go/src/net/http/server.go:2933 +0x35c

@viktorstrate
Copy link
Member

viktorstrate commented Apr 14, 2020

This is because this function is not yet implemented on on the server (see scanner.go:12)

To start the scanner you currently have to press the Scan button next to each user.
It should however be quick and easy to implement a function that scans each user.
First getting all users from the database, then calling scanner.ScanUser(db, userId) for each user returned from the database.

The reason I haven't gotten around to doing this yet, is because I would like to have a queue system such that only one user is scanned at a time, and scans should be cancelable. But this is quite a big feature in it self.

@viktorstrate viktorstrate added API Related to the backend api server written in Go good first issue Good for newcomers improvement labels Apr 14, 2020
@SlavikCA
Copy link
Contributor Author

I see.
Perhaps, as a temporary measure, that "Scan All" button can be removed/disabled on the frontend since it's not implemented on the backend

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API Related to the backend api server written in Go good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants