serlo / api.serlo.org

Public GraphQL API of https://serlo.org/
https://api.serlo.org/___graphql
Apache License 2.0
15 stars 4 forks source link

GraphQLError: Cannot read properties of undefined (reading 'length') #1489

Closed sentry-io[bot] closed 6 months ago

sentry-io[bot] commented 6 months ago

Sentry Issue: API-1HY3

GraphQLError: Cannot read properties of undefined (reading 'length')
  File "/usr/src/app/dist/server.cjs", line 43033, in PromisePool.execute
    const localErr = new Error();
  File "/usr/src/app/dist/server.cjs", line 217453, in Database.execute
    const [rows] = await this.pool.execute(sql, params);
  File "/usr/src/app/dist/server.cjs", line 217436, in Database.fetchOptional
    const [result] = await this.execute(sql, params);
  File "/usr/src/app/dist/server.cjs", line 224923, in Object.resolveUuidFromDatabase [as getCurrentValue]
    const baseUuid = await context.database.fetchOptional(
  File "/usr/src/app/dist/server.cjs", line 223719, in Object.resolveWithDecoder
    const value = await spec2.getCurrentValue(payload, context);
...
(2 additional frame(s) were not displayed)
kulla commented 6 months ago

The reason: Sometimes we have the timestamp 0000-00-00 00:00:00 as lastLogin in our mysql table which causes mysql2 to throw this error => This might be also a bug in this library. Actually we support this type via https://github.com/serlo/api.serlo.org/blob/7a66b7b9f3247bfa5bde2de147efef89ff228960/packages/server/src/schema/uuid/user/resolvers.ts#L284 so that we can delete this