Windows + Prisma: Server process exited with code 3765269347
Originally reported by @Vishal-beep136 in https://github.com/ts-safeql/safeql/issues/255#issuecomment-2298060086
Original comment below:
Heyy I was able to install successfully @ts-safeql/eslint-plugin libpg-query without any errors
however it doesn't seems to work, like it's not linting or showing error. I'm using it with Prisma.
I followed this doc prisma
const query = prisma.$queryRaw`SELECT idd FROM users`;
it should display error like -> Error: column "idd" does not exist
I'm not sure what went wrong I believe I've even configured it correct in .eslintrc.js
module.exports = {
parser: '@typescript-eslint/parser',
parserOptions: {
project: 'tsconfig.json',
tsconfigRootDir: __dirname,
sourceType: 'module',
},
plugins: ['@typescript-eslint/eslint-plugin', '@ts-safeql/eslint-plugin'],
rules: {
....
'@ts-safeql/check-sql': [
'error',
{
connections: [
{
connectionUrl: process.env.DATABASE_URL,
migrationsDir: './prisma/migrations',
targets: [
{ tag: 'prisma.+($queryRaw|$executeRaw)', transform: '{type}[]' },
],
},
],
},
],
},
}
also EsLint is crashing a lot
[Info - 12:20:26 PM] ESLint server running in node v20.14.0
[Info - 12:20:26 PM] ESLint server is running.
[Info - 12:20:27 PM] ESLint library loaded from: D:\app\backend-nestjs\node_modules\eslint\lib\api.js
migrationPath D:\app\backend-nestjs\prisma\migrations
[Error - 12:20:39 PM] Server process exited with code 3765269347.
[Error - 12:20:39 PM] The ESLint server crashed 5 times in the last 3 minutes. The server will not be restarted. See the output for more information.
[Info - 12:20:39 PM] ESLint server stopped.
Could be that @ts-safeql/eslint-plugin libpg-query aren't compatible with windows OS 😭 ??
or Am I missing something ??
Thanks :)
@Vishal-beep136
Research the error further
We can first try to find out what this error code 3765269347 means.
It appears that error code 3765269347 is also known as 0xE06D7363, which apparently means:
The diagnostic is that the DllMain() function inside the DLL died due to an unhandled C++ exception
So it appears there is an unhandled C++ exception somewhere in the Windows version of libpg-query, the code path of which is triggered by SafeQL, causing a crash.
Try a more minimal setup
One thing that I would do in your position is first try out your setup with more minimal code.
@ProchaLu also experienced SafeQL crashing on Windows (with a different error code, 3221226505 ), due to invalid SQL:
- https://github.com/ts-safeql/safeql/issues/243
You can try to first only lint a single file on the command line:
npx eslint backend-nestjs/prisma/migrations/001-users.ts
If that doesn't fail with the same error message, then you can try to expand to other files until you identify which file is causing the problem.
Once you have identified which file is causing SafeQL to crash, then you can check the file contents to see if there is any unusual SQL in there.
Eg. in @ProchaLu's issue linked above, he identified 3 errors which caused crashes with SafeQL on Windows:
- missing comma (should be after
users.id) - curly brackets instead of parentheses (after
ON) - incorrect table name (
userinstead ofusers)
So if any of these (or similar) could apply to your situation, then this may explain the SafeQL crashes.
I've also reported this in a new libpg-query issue, to surface the crashes over there too:
- https://github.com/launchql/libpg-query-node/issues/81
fixed in https://github.com/ts-safeql/safeql/pull/398