Skip to content

[bug]: PostgreSQL database expects numeric IDs for the up_users table, instead of a string documentId #80

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

Open
2 of 3 tasks
woontsoudev opened this issue Apr 28, 2025 · 0 comments
Labels
issue: bug Issue reporting a bug severity: medium If it breaks the basic use of the product but can be worked around status: to be confirmed The issue needs to be reproduced or confirmed by a team member

Comments

@woontsoudev
Copy link

woontsoudev commented Apr 28, 2025

Bug Description

Issue Description

When using the Strapi Client to update user profiles, the client passes string IDs to the Strapi API, but the PostgreSQL database expects numeric IDs for the up_users table. This causes the following error in the Strapi server:

[2025-04-27 23:52:56.480] error: select "t0".* from "public"."up_users" as "t0" where (("t0"."id" = $1)) limit $2 - invalid input syntax for type integer: "vkdx5e0javerx298j9a98r4n"

Root Cause

  1. The Strapi Client library's TypeScript interface for the update() method expects a string documentId, as documented in the official Strapi documentation.
  2. However, Strapi's PostgreSQL implementation for the users collection expects numeric IDs.
  3. The frontend is passing a string ID (vkdx5e0javerx298j9a98r4n) to the update method, which is being passed directly to the database as a parameter for an integer column.

Steps to Reproduce

  1. Use the strapiClient().collection('users') to get the users collection
  2. Call update(documentId, payload) with a string documentId
  3. The error occurs when the query is executed against the PostgreSQL database

Expected Behavior

  • Update the collection items using a documentId

Version

1.3.0

Operating System

MacOS

Runtime Environment

Node.js

Logs

[2025-04-28 12:49:16.634] error: select "t0".* from "public"."up_users" as "t0" where (("t0"."id" = $1)) limit $2 - invalid input syntax for type integer: "d478fn4m2xx7yuzkkcavx8bk"
error: select "t0".* from "public"."up_users" as "t0" where (("t0"."id" = $1)) limit $2 - invalid input syntax for type integer: "d478fn4m2xx7yuzkkcavx8bk"
    at Parser.parseErrorMessage (/Users/woontsou/projects/enterprise-cms/backend/node_modules/pg-protocol/dist/parser.js:283:98)
    at Parser.handlePacket (/Users/woontsou/projects/enterprise-cms/backend/node_modules/pg-protocol/dist/parser.js:122:29)
    at Parser.parse (/Users/woontsou/projects/enterprise-cms/backend/node_modules/pg-protocol/dist/parser.js:35:38)
    at Socket.<anonymous> (/Users/woontsou/projects/enterprise-cms/backend/node_modules/pg-protocol/dist/index.js:11:42)
    at Socket.emit (node:events:518:28)
    at Socket.emit (node:domain:489:12)
    at addChunk (node:internal/streams/readable:561:12)
    at readableAddChunkPushByteMode (node:internal/streams/readable:512:3)
    at Readable.push (node:internal/streams/readable:392:5)
    at TCP.onStreamRead (node:internal/stream_base_commons:189:23)
[2025-04-28 12:49:16.634] http: PUT /api/users/d478fn4m2xx7yuzkkcavx8bk (4 ms) 500

Media

No response

Confirmation Checklist

  • I have checked the existing issues
  • I agree to follow this project's Code of Conduct
  • I would like to work on this issue
@woontsoudev woontsoudev added issue: bug Issue reporting a bug status: to be confirmed The issue needs to be reproduced or confirmed by a team member labels Apr 28, 2025
@hanpaine hanpaine added the severity: medium If it breaks the basic use of the product but can be worked around label May 5, 2025
@github-project-automation github-project-automation bot moved this to To be reviewed (Open) in Developer Experience Squad May 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
issue: bug Issue reporting a bug severity: medium If it breaks the basic use of the product but can be worked around status: to be confirmed The issue needs to be reproduced or confirmed by a team member
Projects
Status: To be reviewed (Open)
Development

No branches or pull requests

2 participants