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

Refactors queries to get user profile and addresses #9705

Merged
merged 21 commits into from
Nov 1, 2024

Conversation

Rotorsoft
Copy link
Contributor

Link to Issue

Closes: #9695

Description of Changes

  • Make sure user profiles and addresses are shown in communities and threads
  • Make sure you can search users

Copy link
Contributor

@masvelio masvelio left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got some errors when searching profiles.

Kapture.2024-10-29.at.10.22.50.mp4

image

10:23:58.043] ERROR (utils.ts): INTERNAL_SERVER_ERROR: [SequelizeDatabaseError] user.searchUserProfiles: invalid reference to FROM-clause entry for table "Addresses" {"fingerprint":"INTERNAL_SERVER_ERROR-SequelizeDatabaseError-user.searchUserProfiles"}
    err: {
      "type": "DatabaseError",
      "message": "invalid reference to FROM-clause entry for table \"Addresses\"",
      "stack":
          Error
              at Query.run (/Users/marcin/Desktop/Projects/commonwealth/node_modules/.pnpm/[email protected][email protected]/node_modules/sequelize/src/dialects/postgres/query.js:76:25)
              at <anonymous> (/Users/marcin/Desktop/Projects/commonwealth/node_modules/.pnpm/[email protected][email protected]/node_modules/sequelize/src/sequelize.js:650:28)
              at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
              at body (/Users/marcin/Desktop/Projects/commonwealth/libs/model/src/user/SearchUserProfiles.query.ts:56:24)
              at query (/Users/marcin/Desktop/Projects/commonwealth/libs/core/src/framework/query.ts:37:12)
              at <anonymous> (/Users/marcin/Desktop/Projects/commonwealth/libs/adapters/src/trpc/handlers.ts:134:24)
              at async resolveMiddleware (file:///Users/marcin/Desktop/Projects/commonwealth/node_modules/.pnpm/@[email protected]/node_modules/@trpc/server/dist/index.mjs:421:30)
              at async callRecursive (file:///Users/marcin/Desktop/Projects/commonwealth/node_modules/.pnpm/@[email protected]/node_modules/@trpc/server/dist/index.mjs:451:32)
              at async outputMiddleware (file:///Users/marcin/Desktop/Projects/commonwealth/node_modules/.pnpm/@[email protected]/node_modules/@trpc/server/dist/index.mjs:302:24)
              at async callRecursive (file:///Users/marcin/Desktop/Projects/commonwealth/node_modules/.pnpm/@[email protected]/node_modules/@trpc/server/dist/index.mjs:451:32)
      "name": "SequelizeDatabaseError",
      "parent": {
        "type": "DatabaseError",
        "message": "invalid reference to FROM-clause entry for table \"Addresses\"",
        "stack":
            error: invalid reference to FROM-clause entry for table "Addresses"
                at Parser.parseErrorMessage (/Users/marcin/Desktop/Projects/commonwealth/node_modules/.pnpm/[email protected]/node_modules/pg-protocol/src/parser.ts:369:69)
                at Parser.handlePacket (/Users/marcin/Desktop/Projects/commonwealth/node_modules/.pnpm/[email protected]/node_modules/pg-protocol/src/parser.ts:188:21)
                at Parser.parse (/Users/marcin/Desktop/Projects/commonwealth/node_modules/.pnpm/[email protected]/node_modules/pg-protocol/src/parser.ts:103:30)
                at Socket.<anonymous> (/Users/marcin/Desktop/Projects/commonwealth/node_modules/.pnpm/[email protected]/node_modules/pg-protocol/src/index.ts:7:48)
                at Socket.emit (node:events:518:28)
                at Socket.emit (node:domain:488:12)
                at addChunk (node:internal/streams/readable:559:12)
                at readableAddChunkPushByteMode (node:internal/streams/readable:510:3)
                at Readable.push (node:internal/streams/readable:390:5)
                at TCP.onStreamRead (node:internal/stream_base_commons:190:23)
        "length": 187,
        "name": "error",
        "severity": "ERROR",
        "code": "42P01",
        "hint": "Perhaps you meant to reference the table alias \"a\".",
        "position": "583",
        "file": "parse_relation.c",
        "line": "3615",
        "routine": "errorMissingRTE",
        "sql": "SELECT\n          U.id AS user_id,\n          U.profile->>'name' AS profile_name,\n          U.profile->>'avatar_url' AS avatar_url,\n          U.created_at,\n          MAX(A.last_active) as last_active,\n          array_agg(\n            json_build_object(\n              'id', A.id,\n              'community_id', A.community_id,\n              'address', A.address,\n              'role', A.role\n            )\n          ) as addresses,\n          COUNT(U.id) OVER()::integer as total\n        FROM\n          \"Users\" U\n          JOIN \"Addresses\" A ON U.id = A.user_id \n        WHERE\n          \"Addresses\".community_id = 'dydx' AND\n          (U.profile->>'name' ILIKE '%peter%')\n        GROUP BY\n          U.id\n        ORDER BY last_active DESC\n        LIMIT 20\n        OFFSET 0"
      },
      "original": {
        "type": "DatabaseError",
        "message": "invalid reference to FROM-clause entry for table \"Addresses\"",
        "stack":
            error: invalid reference to FROM-clause entry for table "Addresses"
                at Parser.parseErrorMessage (/Users/marcin/Desktop/Projects/commonwealth/node_modules/.pnpm/[email protected]/node_modules/pg-protocol/src/parser.ts:369:69)
                at Parser.handlePacket (/Users/marcin/Desktop/Projects/commonwealth/node_modules/.pnpm/[email protected]/node_modules/pg-protocol/src/parser.ts:188:21)
                at Parser.parse (/Users/marcin/Desktop/Projects/commonwealth/node_modules/.pnpm/[email protected]/node_modules/pg-protocol/src/parser.ts:103:30)
                at Socket.<anonymous> (/Users/marcin/Desktop/Projects/commonwealth/node_modules/.pnpm/[email protected]/node_modules/pg-protocol/src/index.ts:7:48)
                at Socket.emit (node:events:518:28)
                at Socket.emit (node:domain:488:12)
                at addChunk (node:internal/streams/readable:559:12)
                at readableAddChunkPushByteMode (node:internal/streams/readable:510:3)
                at Readable.push (node:internal/streams/readable:390:5)
                at TCP.onStreamRead (node:internal/stream_base_commons:190:23)
        "length": 187,
        "name": "error",
        "severity": "ERROR",
        "code": "42P01",
        "hint": "Perhaps you meant to reference the table alias \"a\".",
        "position": "583",
        "file": "parse_relation.c",
        "line": "3615",
        "routine": "errorMissingRTE",
        "sql": "SELECT\n          U.id AS user_id,\n          U.profile->>'name' AS profile_name,\n          U.profile->>'avatar_url' AS avatar_url,\n          U.created_at,\n          MAX(A.last_active) as last_active,\n          array_agg(\n            json_build_object(\n              'id', A.id,\n              'community_id', A.community_id,\n              'address', A.address,\n              'role', A.role\n            )\n          ) as addresses,\n          COUNT(U.id) OVER()::integer as total\n        FROM\n          \"Users\" U\n          JOIN \"Addresses\" A ON U.id = A.user_id \n        WHERE\n          \"Addresses\".community_id = 'dydx' AND\n          (U.profile->>'name' ILIKE '%peter%')\n        GROUP BY\n          U.id\n        ORDER BY last_active DESC\n        LIMIT 20\n        OFFSET 0"
      },
      "sql": "SELECT\n          U.id AS user_id,\n          U.profile->>'name' AS profile_name,\n          U.profile->>'avatar_url' AS avatar_url,\n          U.created_at,\n          MAX(A.last_active) as last_active,\n          array_agg(\n            json_build_object(\n              'id', A.id,\n              'community_id', A.community_id,\n              'address', A.address,\n              'role', A.role\n            )\n          ) as addresses,\n          COUNT(U.id) OVER()::integer as total\n        FROM\n          \"Users\" U\n          JOIN \"Addresses\" A ON U.id = A.user_id \n        WHERE\n          \"Addresses\".community_id = 'dydx' AND\n          (U.profile->>'name' ILIKE '%peter%')\n        GROUP BY\n          U.id\n        ORDER BY last_active DESC\n        LIMIT 20\n        OFFSET 0",
      "parameters": {}
    }

image
image

image

[10:22:38.780] ERROR (setupErrorHandlers.ts): syntax error at or near "" 
  AND ("" {"url":"/api/threads?community_id=dydx&search=peter&limit=20&page=1&order_by=rank&order_direction=DESC&include_count=true","method":"GET","headers":{"host":"localhost:3000","referer":"http://localhost:8080/dydx/search?q=peter&communityScope=dydx&sort=Best"},"user":{"id":128606},"status":500}
    err: {
      "type": "DatabaseError",
      "message": "syntax error at or near \"\" \n  AND (\"\"",
      "stack":
          Error
              at Query.run (/Users/marcin/Desktop/Projects/commonwealth/node_modules/.pnpm/[email protected][email protected]/node_modules/sequelize/src/dialects/postgres/query.js:76:25)
              at <anonymous> (/Users/marcin/Desktop/Projects/commonwealth/node_modules/.pnpm/[email protected][email protected]/node_modules/sequelize/src/sequelize.js:650:28)
              at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
              at body (/Users/marcin/Desktop/Projects/commonwealth/libs/model/src/thread/SearchThreads.query.ts:89:23)
              at query (/Users/marcin/Desktop/Projects/commonwealth/libs/core/src/framework/query.ts:37:12)
              at getThreadsHandler (/Users/marcin/Desktop/Projects/commonwealth/packages/commonwealth/server/routes/threads/get_threads_handler.ts:165:27)
      "name": "SequelizeDatabaseError",
      "parent": {
        "type": "DatabaseError",
        "message": "syntax error at or near \"\" \n  AND (\"\"",
        "stack":
            error: syntax error at or near "" 
              AND (""
                at Parser.parseErrorMessage (/Users/marcin/Desktop/Projects/commonwealth/node_modules/.pnpm/[email protected]/node_modules/pg-protocol/src/parser.ts:369:69)
                at Parser.handlePacket (/Users/marcin/Desktop/Projects/commonwealth/node_modules/.pnpm/[email protected]/node_modules/pg-protocol/src/parser.ts:188:21)
                at Parser.parse (/Users/marcin/Desktop/Projects/commonwealth/node_modules/.pnpm/[email protected]/node_modules/pg-protocol/src/parser.ts:103:30)
                at Socket.<anonymous> (/Users/marcin/Desktop/Projects/commonwealth/node_modules/.pnpm/[email protected]/node_modules/pg-protocol/src/index.ts:7:48)
                at Socket.emit (node:events:518:28)
                at Socket.emit (node:domain:488:12)
                at addChunk (node:internal/streams/readable:559:12)
                at readableAddChunkPushByteMode (node:internal/streams/readable:510:3)
                at Readable.push (node:internal/streams/readable:390:5)
                at TCP.onStreamRead (node:internal/stream_base_commons:190:23)
        "length": 101,
        "name": "error",
        "severity": "ERROR",
        "code": "42601",
        "position": "578",
        "file": "scan.l",
        "line": "1192",
        "routine": "scanner_yyerror",
        "sql": "SELECT \n  \"Threads\".id,\n  \"Threads\".title,\n  \"Threads\".body,\n  'thread' as type,\n  \"Addresses\".id as address_id,\n  \"Addresses\".user_id as address_user_id,\n  \"Addresses\".address,\n  \"Addresses\".community_id as address_community_id,\n  \"Threads\".created_at,\n  \"Threads\".community_id as community_id,\n  COUNT(*) OVER() AS total_count, \n  ts_rank_cd(\"Threads\".search, tsquery) as rank\nFROM \n  \"Threads\"\n  JOIN \"Addresses\" ON \"Threads\".address_id = \"Addresses\".id,\n  websearch_to_tsquery('english', $1) as tsquery\nWHERE\n  \"Threads\".deleted_at IS NULL\n  AND \"Threads\".community_id = $2\" \n  AND (\"Threads\".title ILIKE '%' || $1 || '%' \n  OR tsquery @@ \"Threads\".search)\nORDER BY rank DESC , \"Threads\".created_at DESC LIMIT $3 OFFSET $4",
        "parameters": [
          "peter",
          "dydx",
          20,
          0
        ]
      },
      "original": {
        "type": "DatabaseError",
        "message": "syntax error at or near \"\" \n  AND (\"\"",
        "stack":
            error: syntax error at or near "" 
              AND (""
                at Parser.parseErrorMessage (/Users/marcin/Desktop/Projects/commonwealth/node_modules/.pnpm/[email protected]/node_modules/pg-protocol/src/parser.ts:369:69)
                at Parser.handlePacket (/Users/marcin/Desktop/Projects/commonwealth/node_modules/.pnpm/[email protected]/node_modules/pg-protocol/src/parser.ts:188:21)
                at Parser.parse (/Users/marcin/Desktop/Projects/commonwealth/node_modules/.pnpm/[email protected]/node_modules/pg-protocol/src/parser.ts:103:30)
                at Socket.<anonymous> (/Users/marcin/Desktop/Projects/commonwealth/node_modules/.pnpm/[email protected]/node_modules/pg-protocol/src/index.ts:7:48)
                at Socket.emit (node:events:518:28)
                at Socket.emit (node:domain:488:12)
                at addChunk (node:internal/streams/readable:559:12)
                at readableAddChunkPushByteMode (node:internal/streams/readable:510:3)
                at Readable.push (node:internal/streams/readable:390:5)
                at TCP.onStreamRead (node:internal/stream_base_commons:190:23)
        "length": 101,
        "name": "error",
        "severity": "ERROR",
        "code": "42601",
        "position": "578",
        "file": "scan.l",
        "line": "1192",
        "routine": "scanner_yyerror",
        "sql": "SELECT \n  \"Threads\".id,\n  \"Threads\".title,\n  \"Threads\".body,\n  'thread' as type,\n  \"Addresses\".id as address_id,\n  \"Addresses\".user_id as address_user_id,\n  \"Addresses\".address,\n  \"Addresses\".community_id as address_community_id,\n  \"Threads\".created_at,\n  \"Threads\".community_id as community_id,\n  COUNT(*) OVER() AS total_count, \n  ts_rank_cd(\"Threads\".search, tsquery) as rank\nFROM \n  \"Threads\"\n  JOIN \"Addresses\" ON \"Threads\".address_id = \"Addresses\".id,\n  websearch_to_tsquery('english', $1) as tsquery\nWHERE\n  \"Threads\".deleted_at IS NULL\n  AND \"Threads\".community_id = $2\" \n  AND (\"Threads\".title ILIKE '%' || $1 || '%' \n  OR tsquery @@ \"Threads\".search)\nORDER BY rank DESC , \"Threads\".created_at DESC LIMIT $3 OFFSET $4",
        "parameters": [
          "peter",
          "dydx",
          20,
          0
        ]
      },
      "sql": "SELECT \n  \"Threads\".id,\n  \"Threads\".title,\n  \"Threads\".body,\n  'thread' as type,\n  \"Addresses\".id as address_id,\n  \"Addresses\".user_id as address_user_id,\n  \"Addresses\".address,\n  \"Addresses\".community_id as address_community_id,\n  \"Threads\".created_at,\n  \"Threads\".community_id as community_id,\n  COUNT(*) OVER() AS total_count, \n  ts_rank_cd(\"Threads\".search, tsquery) as rank\nFROM \n  \"Threads\"\n  JOIN \"Addresses\" ON \"Threads\".address_id = \"Addresses\".id,\n  websearch_to_tsquery('english', $1) as tsquery\nWHERE\n  \"Threads\".deleted_at IS NULL\n  AND \"Threads\".community_id = $2\" \n  AND (\"Threads\".title ILIKE '%' || $1 || '%' \n  OR tsquery @@ \"Threads\".search)\nORDER BY rank DESC , \"Threads\".created_at DESC LIMIT $3 OFFSET $4",
      "parameters": [
        "peter",
        "dydx",
        20,
        0
      ]
    }
    ```

@Rotorsoft
Copy link
Contributor Author

@masvelio I cannot play the clip above, but I fixed something in the query. Can you pls try again and send me the URL that's failing if you can reproduce after the last commit? 🙇

@masvelio
Copy link
Contributor

@masvelio I cannot play the clip above, but I fixed something in the query. Can you pls try again and send me the URL that's failing if you can reproduce after the last commit? 🙇

other errors seems to be gone, now I am getting this on community that has contests

[16:07:54.776] ERROR (utils.ts): INTERNAL_SERVER_ERROR: [ZodError] contest.getAllContests: [
  {
    "code": "invalid_type",
    "expected": "string",
    "received": "number",
    "path": [
      1,
      "contests",
      0,
      "score",
      0,
      "votes"
    ],
    "message": "Expected string, received number"
  },
  {
    "code": "invalid_type",
    "expected": "string",
    "received": "number",
    "path": [
      3,
      "contests",
      0,
      "score",
      0,
      "votes"
    ],
    "message": "Expected string, received number"
  },
  {
    "code": "invalid_type",
    "expected": "string",
    "received": "number",
    "path": [
      4,
      "contests",
      0,
      "score",
      0,
      "votes"
    ],
    "message": "Expected string, received number"
  }
] {"fingerprint":"INTERNAL_SERVER_ERROR-ZodError-contest.getAllContests-invalid_type-invalid_type-invalid_type"}
    err: {
      "type": "ZodError",
      "message": "[\n  {\n    \"code\": \"invalid_type\",\n    \"expected\": \"string\",\n    \"received\": \"number\",\n    \"path\": [\n      1,\n      \"contests\",\n      0,\n      \"score\",\n      0,\n      \"votes\"\n    ],\n    \"message\": \"Expected string, received number\"\n  },\n  {\n    \"code\": \"invalid_type\",\n    \"expected\": \"string\",\n    \"received\": \"number\",\n    \"path\": [\n      3,\n      \"contests\",\n      0,\n      \"score\",\n      0,\n      \"votes\"\n    ],\n    \"message\": \"Expected string, received number\"\n  },\n  {\n    \"code\": \"invalid_type\",\n    \"expected\": \"string\",\n    \"received\": \"number\",\n    \"path\": [\n      4,\n      \"contests\",\n      0,\n      \"score\",\n      0,\n      \"votes\"\n    ],\n    \"message\": \"Expected string, received number\"\n  }\n]",
      "stack":
          ZodError: [
            {
              "code": "invalid_type",
              "expected": "string",
              "received": "number",
              "path": [
                1,
                "contests",
                0,
                "score",
                0,
                "votes"
              ],
              "message": "Expected string, received number"
            },
            {
              "code": "invalid_type",
              "expected": "string",
              "received": "number",
              "path": [
                3,
                "contests",
                0,
                "score",
                0,
                "votes"
              ],
              "message": "Expected string, received number"
            },
            {
              "code": "invalid_type",
              "expected": "string",
              "received": "number",
              "path": [
                4,
                "contests",
                0,
                "score",
                0,
                "votes"
              ],
              "message": "Expected string, received number"
            }
          ]
              at get error [as error] (file:///Users/marcin/Desktop/Projects/commonwealth/node_modules/.pnpm/[email protected]/node_modules/zod/lib/index.mjs:587:31)
              at ZodArray.parseAsync (file:///Users/marcin/Desktop/Projects/commonwealth/node_modules/.pnpm/[email protected]/node_modules/zod/lib/index.mjs:715:22)
              at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
              at async outputMiddleware (file:///Users/marcin/Desktop/Projects/commonwealth/node_modules/.pnpm/@[email protected]/node_modules/@trpc/server/dist/index.mjs:308:26)
              at async callRecursive (file:///Users/marcin/Desktop/Projects/commonwealth/node_modules/.pnpm/@[email protected]/node_modules/@trpc/server/dist/index.mjs:451:32)
              at async callRecursive (file:///Users/marcin/Desktop/Projects/commonwealth/node_modules/.pnpm/@[email protected]/node_modules/@trpc/server/dist/index.mjs:451:32)
              at <anonymous> (/Users/marcin/Desktop/Projects/commonwealth/libs/adapters/src/trpc/middleware.ts:180:22)
              at async callRecursive (file:///Users/marcin/Desktop/Projects/commonwealth/node_modules/.pnpm/@[email protected]/node_modules/@trpc/server/dist/index.mjs:451:32)
              at async callRecursive (file:///Users/marcin/Desktop/Projects/commonwealth/node_modules/.pnpm/@[email protected]/node_modules/@trpc/server/dist/index.mjs:451:32)
              at async resolve (file:///Users/marcin/Desktop/Projects/commonwealth/node_modules/.pnpm/@[email protected]/node_modules/@trpc/server/dist/index.mjs:481:24)
      "aggregateErrors": [
        {
          "type": "Object",
          "message": "Expected string, received number",
          "stack":
              
          "code": "invalid_type",
          "expected": "string",
          "received": "number",
          "path": [
            1,
            "contests",
            0,
            "score",
            0,
            "votes"
          ]
        },
        {
          "type": "Object",
          "message": "Expected string, received number",
          "stack":
              
          "code": "invalid_type",
          "expected": "string",
          "received": "number",
          "path": [
            3,
            "contests",
            0,
            "score",
            0,
            "votes"
          ]
        },
        {
          "type": "Object",
          "message": "Expected string, received number",
          "stack":
              
          "code": "invalid_type",
          "expected": "string",
          "received": "number",
          "path": [
            4,
            "contests",
            0,
            "score",
            0,
            "votes"
          ]
        }
      ],
      "issues": [
        {
          "code": "invalid_type",
          "expected": "string",
          "received": "number",
          "path": [
            1,
            "contests",
            0,
            "score",
            0,
            "votes"
          ],
          "message": "Expected string, received number"
        },
        {
          "code": "invalid_type",
          "expected": "string",
          "received": "number",
          "path": [
            3,
            "contests",
            0,
            "score",
            0,
            "votes"
          ],
          "message": "Expected string, received number"
        },
        {
          "code": "invalid_type",
          "expected": "string",
          "received": "number",
          "path": [
            4,
            "contests",
            0,
            "score",
            0,
            "votes"
          ],
          "message": "Expected string, received number"
        }
      ],
      "name": "ZodError"
    }
    ```

@Rotorsoft
Copy link
Contributor Author

@masvelio I cannot play the clip above, but I fixed something in the query. Can you pls try again and send me the URL that's failing if you can reproduce after the last commit? 🙇

other errors seems to be gone, now I am getting this on community that has contests

[16:07:54.776] ERROR (utils.ts): INTERNAL_SERVER_ERROR: [ZodError] contest.getAllContests: [
  {
    "code": "invalid_type",
    "expected": "string",
    "received": "number",
    "path": [
      1,
      "contests",
      0,
      "score",
      0,
      "votes"
    ],
    "message": "Expected string, received number"
  },
  {
    "code": "invalid_type",
    "expected": "string",
    "received": "number",
    "path": [
      3,
      "contests",
      0,
      "score",
      0,
      "votes"
    ],
    "message": "Expected string, received number"
  },
  {
    "code": "invalid_type",
    "expected": "string",
    "received": "number",
    "path": [
      4,
      "contests",
      0,
      "score",
      0,
      "votes"
    ],
    "message": "Expected string, received number"
  }
] {"fingerprint":"INTERNAL_SERVER_ERROR-ZodError-contest.getAllContests-invalid_type-invalid_type-invalid_type"}
    err: {
      "type": "ZodError",
      "message": "[\n  {\n    \"code\": \"invalid_type\",\n    \"expected\": \"string\",\n    \"received\": \"number\",\n    \"path\": [\n      1,\n      \"contests\",\n      0,\n      \"score\",\n      0,\n      \"votes\"\n    ],\n    \"message\": \"Expected string, received number\"\n  },\n  {\n    \"code\": \"invalid_type\",\n    \"expected\": \"string\",\n    \"received\": \"number\",\n    \"path\": [\n      3,\n      \"contests\",\n      0,\n      \"score\",\n      0,\n      \"votes\"\n    ],\n    \"message\": \"Expected string, received number\"\n  },\n  {\n    \"code\": \"invalid_type\",\n    \"expected\": \"string\",\n    \"received\": \"number\",\n    \"path\": [\n      4,\n      \"contests\",\n      0,\n      \"score\",\n      0,\n      \"votes\"\n    ],\n    \"message\": \"Expected string, received number\"\n  }\n]",
      "stack":
          ZodError: [
            {
              "code": "invalid_type",
              "expected": "string",
              "received": "number",
              "path": [
                1,
                "contests",
                0,
                "score",
                0,
                "votes"
              ],
              "message": "Expected string, received number"
            },
            {
              "code": "invalid_type",
              "expected": "string",
              "received": "number",
              "path": [
                3,
                "contests",
                0,
                "score",
                0,
                "votes"
              ],
              "message": "Expected string, received number"
            },
            {
              "code": "invalid_type",
              "expected": "string",
              "received": "number",
              "path": [
                4,
                "contests",
                0,
                "score",
                0,
                "votes"
              ],
              "message": "Expected string, received number"
            }
          ]
              at get error [as error] (file:///Users/marcin/Desktop/Projects/commonwealth/node_modules/.pnpm/[email protected]/node_modules/zod/lib/index.mjs:587:31)
              at ZodArray.parseAsync (file:///Users/marcin/Desktop/Projects/commonwealth/node_modules/.pnpm/[email protected]/node_modules/zod/lib/index.mjs:715:22)
              at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
              at async outputMiddleware (file:///Users/marcin/Desktop/Projects/commonwealth/node_modules/.pnpm/@[email protected]/node_modules/@trpc/server/dist/index.mjs:308:26)
              at async callRecursive (file:///Users/marcin/Desktop/Projects/commonwealth/node_modules/.pnpm/@[email protected]/node_modules/@trpc/server/dist/index.mjs:451:32)
              at async callRecursive (file:///Users/marcin/Desktop/Projects/commonwealth/node_modules/.pnpm/@[email protected]/node_modules/@trpc/server/dist/index.mjs:451:32)
              at <anonymous> (/Users/marcin/Desktop/Projects/commonwealth/libs/adapters/src/trpc/middleware.ts:180:22)
              at async callRecursive (file:///Users/marcin/Desktop/Projects/commonwealth/node_modules/.pnpm/@[email protected]/node_modules/@trpc/server/dist/index.mjs:451:32)
              at async callRecursive (file:///Users/marcin/Desktop/Projects/commonwealth/node_modules/.pnpm/@[email protected]/node_modules/@trpc/server/dist/index.mjs:451:32)
              at async resolve (file:///Users/marcin/Desktop/Projects/commonwealth/node_modules/.pnpm/@[email protected]/node_modules/@trpc/server/dist/index.mjs:481:24)
      "aggregateErrors": [
        {
          "type": "Object",
          "message": "Expected string, received number",
          "stack":
              
          "code": "invalid_type",
          "expected": "string",
          "received": "number",
          "path": [
            1,
            "contests",
            0,
            "score",
            0,
            "votes"
          ]
        },
        {
          "type": "Object",
          "message": "Expected string, received number",
          "stack":
              
          "code": "invalid_type",
          "expected": "string",
          "received": "number",
          "path": [
            3,
            "contests",
            0,
            "score",
            0,
            "votes"
          ]
        },
        {
          "type": "Object",
          "message": "Expected string, received number",
          "stack":
              
          "code": "invalid_type",
          "expected": "string",
          "received": "number",
          "path": [
            4,
            "contests",
            0,
            "score",
            0,
            "votes"
          ]
        }
      ],
      "issues": [
        {
          "code": "invalid_type",
          "expected": "string",
          "received": "number",
          "path": [
            1,
            "contests",
            0,
            "score",
            0,
            "votes"
          ],
          "message": "Expected string, received number"
        },
        {
          "code": "invalid_type",
          "expected": "string",
          "received": "number",
          "path": [
            3,
            "contests",
            0,
            "score",
            0,
            "votes"
          ],
          "message": "Expected string, received number"
        },
        {
          "code": "invalid_type",
          "expected": "string",
          "received": "number",
          "path": [
            4,
            "contests",
            0,
            "score",
            0,
            "votes"
          ],
          "message": "Expected string, received number"
        }
      ],
      "name": "ZodError"
    }
    ```

Ok, should be fixed now... it was a change in contest schemas that I just merged from master that required a migration and adjustments to the view schema

Copy link
Contributor

@masvelio masvelio left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still getting zod error from contests
Try this community http://localhost:8080/common/discussions

[09:59:27.023] ERROR (utils.ts): INTERNAL_SERVER_ERROR: [ZodError] contest.getAllContests: [
  {
    "code": "invalid_type",
    "expected": "string",
    "received": "number",
    "path": [
      1,
      "contests",
      0,
      "score",
      0,
      "votes"
    ],
    "message": "Expected string, received number"
  },
  {
    "code": "invalid_type",
    "expected": "string",
    "received": "number",
    "path": [
      3,
      "contests",
      0,
      "score",
      0,
      "votes"
    ],
    "message": "Expected string, received number"
  },
  {
    "code": "invalid_type",
    "expected": "string",
    "received": "number",
    "path": [
      4,
      "contests",
      0,
      "score",
      0,
      "votes"
    ],
    "message": "Expected string, received number"
  }
]

Also getting different error when I want to mention user in comment or thread. Works fine on prod,

Kapture.2024-10-30.at.10.03.07.mp4

@Rotorsoft
Copy link
Contributor Author

@masvelio other than the code quality error (probably related to the change is schema from text to body), everything else looks good to me, including mentions and contests - just tested locally

Guess you'll deal with the vanilla issue in another PR

Thanks for taking care of the client side 👍

Copy link
Contributor

@mzparacha mzparacha left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Clicked around and tested different instances of user info/displays, worked well. Only found this 1 issue above. Otherwise LGTM. Thanks for all the hard work!

@Rotorsoft Rotorsoft merged commit 01fb1e3 into master Nov 1, 2024
10 checks passed
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

Successfully merging this pull request may close these issues.

🟩 GetUserProfile, GetUserAddresses, SearchUserProfiles
5 participants