ianlucas / cs2-inventory-simulator

A Counter-Strike 2 Inventory Simulator
https://inventory.cstrike.app
MIT License
35 stars 13 forks source link

[BUG] Error Prisma (the provided value for the column is too long) #85

Closed SkyJust4Fun closed 5 months ago

SkyJust4Fun commented 5 months ago

Everything works as planned when inventory is brandy new, but whenever a skins or any entitie is added to the inventory if i try to check

The file: http://localhost:3000/api/equipped/v3/steamid.json it reports this error here:

PrismaClientKnownRequestError: Invalid prisma.userCache.upsert() invocation:

The provided value for the column is too long for the column's type. Column: body at In.handleRequestError (/var/www/html/testeskins/node_modules/@prisma/client/runtime/library.js:122:6877) at In.handleAndLogRequestError (/var/www/html/testeskins/node_modules/@prisma/client/runtime/library.js:122:6211) at In.request (/var/www/html/testeskins/node_modules/@prisma/client/runtime/library.js:122:5919) at l (/var/www/html/testeskins/node_modules/@prisma/client/runtime/library.js:127:11167) at handleUserCachedResponse (file:///var/www/html/testeskins/build/server/index.js?t=1719030628369.3376:99182:3) at loader$f (file:///var/www/html/testeskins/build/server/index.js?t=1719030628369.3376:99339:10) at Object.callRouteLoader (/var/www/html/testeskins/node_modules/@remix-run/server-runtime/dist/data.js:66:16) at /var/www/html/testeskins/node_modules/@remix-run/router/router.ts:4266:21 at callLoaderOrAction (/var/www/html/testeskins/node_modules/@remix-run/router/router.ts:4328:16) at async Promise.all (index 1) { code: 'P2000', clientVersion: '5.15.1', meta: { modelName: 'UserCache', column_name: 'body' } }

I looked at the file manually because i get an error 404 (Missing file) on cs2 servers console when updating the skins..

I dont know if i have done anything wrong.. or is anything wrong with db itself.

On my db the tables that got any info inside them are:

table: rule; table: user; (Only my steam account)

The rest of the db tables are empty.. (Not sure if its supposed to be like that)

Im looking for help on this :c , Sorry for being annoying...

SkyJust4Fun commented 5 months ago

my env file:

DATABASE_URL="mysql://user:password@localhost:3306/database_name?schema=public"

SESSION_SECRET="SecretKey" STEAM_API_KEY="SteamAPIKey" STEAM_CALLBACK_URL="http://localhost:3000/sign-in/steam/callback"

(The appearance of "SteamApiKey","user:password..." show up for privacy meanings, please assume these are correct)

My schema.prisma:

generator client { provider = "prisma-client-js" previewFeatures = ["fullTextSearch"] }

datasource db { provider = "mysql" url = env("DATABASE_URL") } (...)

ianlucas commented 5 months ago

How many items are equipped for the inventory you're trying to fetch?

ianlucas commented 5 months ago

my env file:

DATABASE_URL="mysql://user:password@localhost:3306/database_name?schema=public"

SESSION_SECRET="SecretKey" STEAM_API_KEY="SteamAPIKey" STEAM_CALLBACK_URL="http://localhost:3000/sign-in/steam/callback"

(The appearance of "SteamApiKey","user:password..." show up for privacy meanings, please assume these are correct)

My schema.prisma:

generator client { provider = "prisma-client-js" previewFeatures = ["fullTextSearch"] }

datasource db { provider = "mysql" url = env("DATABASE_URL") } (...)

Oh there's the issue. The project only supports postgres provider, and you're using mysql. According to Prisma's docs "String" translates to varchar(191) in MySQL database, so you must update the String types to something that supports more characters.

Closing this as this is unrelated to Inventory Simulator.