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

SafeQL (libpg-query) is not compatible with GLIBC > 2.34 #196

Closed
developer-vtnetzwelt opened this issue Dec 22, 2023 · 31 comments
Closed

SafeQL (libpg-query) is not compatible with GLIBC > 2.34 #196

developer-vtnetzwelt opened this issue Dec 22, 2023 · 31 comments
Labels

Comments

@developer-vtnetzwelt
Copy link

Describe the bug
I'm trying to use safeql in a new project along side prisma but I'm not getting any lint errors, it doesn't seem to be working

To Reproduce
I have put a small sample example in this repo https://github.com/developer-vtnetzwelt/safeql-prisma-demo , I have written a wrong SQL query in the main file but when I run "npm run build", I'm not getting any errors

Expected behavior
It should give me an error that column "iddss" does not exist

Desktop (please complete the following information):

  • OS: Ubuntu 22.04.3 LTS
  • PostgreSQL version 14
  • Node version v18.16.0
@Newbie012
Copy link
Collaborator

@developer-vtnetzwelt
Copy link
Author

developer-vtnetzwelt commented Dec 22, 2023

@Newbie012 thanks for replying,
I have added the package and ran npm run lint but I still don't see any output, the console freezes. I have updated the repo, could you please try to run it at your end once?
Also I don't see any errors in my visual studio code, I have ESLINT(dbaeumer.vscode-eslint) plugin installed and disabled all other extensions but still no luck

Screenshot from 2023-12-22 16-10-44

@Newbie012
Copy link
Collaborator

Newbie012 commented Dec 22, 2023

That's odd. It seems to work on my end when I pull your changes.

It looks like ESLint is unable to retrieve the generated results from SafeQL's generator. Could you please:

  1. yarn add @ts-safeql/generate postgres
  2. create test.ts file:
import { createGenerator } from '@ts-safeql/generate'
import { parseQuerySync } from 'libpg-query'
import postgres from 'postgres'

async function run (query: string): Promise<void> {
  const sql = postgres({ user: 'postgres', password: 'postgres', database: 'safeql_prisma_demo' })

  const generator = createGenerator()
  console.log('✅ generator created')

  const parsed = parseQuerySync(query)
  console.log('✅ query parsed')

  const result = await generator.generate({
    cacheKey: 'test',
    fieldTransform: undefined,
    pgParsed: parsed,
    query,
    sql,
    cacheMetadata: false,
    nullAsOptional: false,
    nullAsUndefined: false,
    overrides: undefined
  })
  console.log('✅ query generated')

  console.log(JSON.stringify(result, null, 2))

  await sql.end()
}

void run('SELECT * FROM "Post"')
  1. run yarn tsx test.ts
  2. Paste here the output.

@developer-vtnetzwelt
Copy link
Author

@Newbie012 this is the output I'm getting

warning package.json: No license field
$ /home/netzwelt/Desktop/prisma/node_modules/.bin/tsx test.ts
✅ generator created
✅ query parsed
✅ query generated
{
"_tag": "Right",
"right": {
"result": [
[
"id",
"number"
],
[
"createdAt",
"Date"
],
[
"updatedAt",
"Date"
],
[
"published",
"boolean"
],
[
"title",
"string"
],
[
"content",
"string | null"
],
[
"authorId",
"number"
]
],
"stmt": {
"string": "SELECT * FROM "Post"",
"types": [],
"name": "9nkik6wshgj5",
"columns": [
{
"name": "id",
"table": 26329,
"number": 1,
"type": 23
},
{
"name": "createdAt",
"table": 26329,
"number": 2,
"type": 1114
},
{
"name": "updatedAt",
"table": 26329,
"number": 3,
"type": 1114
},
{
"name": "published",
"table": 26329,
"number": 4,
"type": 16
},
{
"name": "title",
"table": 26329,
"number": 5,
"type": 25
},
{
"name": "content",
"table": 26329,
"number": 6,
"type": 25
},
{
"name": "authorId",
"table": 26329,
"number": 7,
"type": 23
}
]
},
"query": "SELECT * FROM "Post""
}
}
Done in 0.26s.

@Newbie012
Copy link
Collaborator

Okay, so it seems like the generator is working okay. It's probably the worker that bridges them. Since ESLint doesn't allow "async" rules, SafeQL uses synckit to perform async work synchronously.

Behind the scenes, it does two things:

  • if migrationsDir is specified, it runs the necessary migrations in a shadow database.
  • runs the generator.

I want to check if the issue is somewhat related to migrationsDir. In order to do that, could you try to:

+ "databaseUrl": "postgresql://postgres:postgres@localhost:5432/safeql_prisma_demo"
- "migrationsDir": "./prisma/migrations",

and then re-run eslint?

@developer-vtnetzwelt
Copy link
Author

@Newbie012 After doing the above mentioned change , I get these results:

  • If I have a error in my SQL
    Screenshot from 2023-12-26 10-17-16
  • If I don't have a error in my SQL
    Screenshot from 2023-12-26 10-19-30

Also I'm not getting any lint errors in my VSC, it's only when I run the command then I can see the errors

@Newbie012
Copy link
Collaborator

  1. This looks ok. Restart ESLint in your IDE to take effect.
  2. This looks like a bug due to the usage of Array<X> rather than X[]. Could you please verify that? It should be fixed in 3.0.0.

The reason why creating the shadow database (migrationsDir) gets stuck, is still unknown to me since I couldn't reproduce it. I'll keep this issue open for now.

@Newbie012 Newbie012 changed the title SafeQl not working Getting a timesout when using migrationsDir Dec 26, 2023
@developer-vtnetzwelt
Copy link
Author

@Newbie012 I'm getting this error in the VS code output tab
Screenshot from 2023-12-26 14-23-51
due to this issue eslint is not working in VSC

@Newbie012
Copy link
Collaborator

Your OS has issues running the compiled queryparser from libpg-query which SafeQL requires in order to parse and analyze the query. Try to sudo apt update re-install node_modules.

@developer-vtnetzwelt
Copy link
Author

developer-vtnetzwelt commented Dec 26, 2023

@Newbie012 I had already tried that but still getting the error, The error says "GLIBC 2.34 not found" but my system has "(Ubuntu GLIBC 2.35-0ubuntu3.5) 2.35"

@Newbie012
Copy link
Collaborator

Newbie012 commented Dec 26, 2023

Oh, I see. It seems like libpg-query-node is a bit behind schedule. I'll raise an issue there. Thanks for reporting that.

Edit - launchql/libpg-query-node#39

@developer-vtnetzwelt
Copy link
Author

@Newbie012 thanks for the help, Could please put the link of the opened issue in the chat

@Newbie012 Newbie012 changed the title Getting a timesout when using migrationsDir SafeQL (libpg-query) is not compatible with GLIBC > 2.34 Dec 26, 2023
@developer-vtnetzwelt
Copy link
Author

@Newbie012 It seems there is no activity on the linked issue, can you try some other workaround for this?

@karlhorky
Copy link
Collaborator

I think the glibc problem has been fixed in libpg_query upstream:

Wonder if the precompiled binaries for Node.js 20.x for linux/amd64, linux/arm64, darwin/arm64 work around this for now:

@xegulon
Copy link

xegulon commented Feb 4, 2024

@karlhorky we're waiting for libpg-query-node for this issue to be solved then?

@karlhorky
Copy link
Collaborator

karlhorky commented Feb 4, 2024

@xegulon correct, I think a new release of libpg-query-node will resolve this

@xegulon
Copy link

xegulon commented Feb 7, 2024

@karlhorky thanks for your answer!

Is there something blocking for the binary to be built? Can't wait to use SafeQL on my current project 😄

@wale
Copy link

wale commented Feb 20, 2024

@karlhorky we're waiting for libpg-query-node for this issue to be solved then?

Submitted a PR to fix the issue (at least on Linux, tested on Fedora Linux 39) : launchql/libpg-query-node#40

@karlhorky
Copy link
Collaborator

karlhorky commented Feb 21, 2024

Seems like @wale's PR was merged and published, so this should be resolved now with libpg-query@16.0.1

(note: the latest tag in npm is actually currently libpg-query@15.0.3-wasm.0.1, which I'm not sure fixes the glibc problems - so if you need the newer version, install it specifically with the 16.0.1 version number)

Copying the comment here for completeness:

I installed libpg-query@16.0.1 just now on Ubuntu 22.04.4 LTS, seems to compile ok (and linting succeeded too with SafeQL - which depends on libpg-query):

$ pnpm add --save-dev libpg-query@16.0.1
...
.../node_modules/libpg-query install$ node-pre-gyp install --fallback-to-build
.../node_modules/libpg-query install: node-pre-gyp info it worked if it ends with ok
.../node_modules/libpg-query install: node-pre-gyp info using node-pre-gyp@1.0.11
.../node_modules/libpg-query install: node-pre-gyp info using node@20.11.1 | linux | x64
.../node_modules/libpg-query install: node-pre-gyp info check checked for "/home/runner/work/next-js-example-winter-2024-atvie/next-js-example-winter-2024-atvie/node_modules/.pnpm/libpg-query@16.0.1/node_modules/libpg-query/build/Release/queryparser.node" (not found)
.../node_modules/libpg-query install: node-pre-gyp http GET https://supabase-public-artifacts-bucket.s3.amazonaws.com/libpg-query-node/queryparser-v16.0.1-node-v115-linux-x64.tar.gz
.../node_modules/libpg-query install: node-pre-gyp ERR! install response status 404 Not Found on https://supabase-public-artifacts-bucket.s3.amazonaws.com/libpg-query-node/queryparser-v16.0.1-node-v115-linux-x64.tar.gz 
.../node_modules/libpg-query install: node-pre-gyp WARN Pre-built binaries not installable for libpg-query@16.0.1 and node@20.11.1 (node-v115 ABI, glibc) (falling back to source compile with node-gyp) 
.../node_modules/libpg-query install: node-pre-gyp WARN Hit error response status 404 Not Found on https://supabase-public-artifacts-bucket.s3.amazonaws.com/libpg-query-node/queryparser-v16.0.1-node-v115-linux-x64.tar.gz 
.../node_modules/libpg-query install: gyp info it worked if it ends with ok
.../node_modules/libpg-query install: gyp info using node-gyp@9.4.1
.../node_modules/libpg-query install: gyp info using node@20.11.1 | linux | x64
.../node_modules/libpg-query install: gyp info ok 
.../node_modules/libpg-query install: gyp info it worked if it ends with ok
.../node_modules/libpg-query install: gyp info using node-gyp@9.4.1
.../node_modules/libpg-query install: gyp info using node@20.11.1 | linux | x64
.../node_modules/libpg-query install: gyp info find Python using Python version 3.10.12 found at "/usr/bin/python3"
.../node_modules/libpg-query install: gyp http GET https://nodejs.org/download/release/v20.11.1/node-v20.11.1-headers.tar.gz
.../node_modules/libpg-query install: gyp http 200 https://nodejs.org/download/release/v20.11.1/node-v20.11.1-headers.tar.gz
.../node_modules/libpg-query install: gyp http GET https://nodejs.org/download/release/v20.11.1/SHASUMS256.txt
.../node_modules/libpg-query install: gyp http 200 https://nodejs.org/download/release/v20.11.1/SHASUMS256.txt
.../node_modules/libpg-query install: gyp info spawn /usr/bin/python3
.../node_modules/libpg-query install: gyp info spawn args [
.../node_modules/libpg-query install: gyp info spawn args   '/home/runner/setup-pnpm/node_modules/.pnpm/pnpm@8.15.3/node_modules/pnpm/dist/node_modules/node-gyp/gyp/gyp_main.py',
.../node_modules/libpg-query install: gyp info spawn args   'binding.gyp',
.../node_modules/libpg-query install: gyp info spawn args   '-f',
.../node_modules/libpg-query install: gyp info spawn args   'make',
.../node_modules/libpg-query install: gyp info spawn args   '-I',
.../node_modules/libpg-query install: gyp info spawn args   '/home/runner/work/next-js-example-winter-2024-atvie/next-js-example-winter-2024-atvie/node_modules/.pnpm/libpg-query@16.0.1/node_modules/libpg-query/build/config.gypi',
.../node_modules/libpg-query install: gyp info spawn args   '-I',
.../node_modules/libpg-query install: gyp info spawn args   '/home/runner/setup-pnpm/node_modules/.pnpm/pnpm@8.15.3/node_modules/pnpm/dist/node_modules/node-gyp/addon.gypi',
.../node_modules/libpg-query install: gyp info spawn args   '-I',
.../node_modules/libpg-query install: gyp info spawn args   '/home/runner/.cache/node-gyp/20.11.1/include/node/common.gypi',
.../node_modules/libpg-query install: gyp info spawn args   '-Dlibrary=shared_library',
.../node_modules/libpg-query install: gyp info spawn args   '-Dvisibility=default',
.../node_modules/libpg-query install: gyp info spawn args   '-Dnode_root_dir=/home/runner/.cache/node-gyp/20.11.1',
.../node_modules/libpg-query install: gyp info spawn args   '-Dnode_gyp_dir=/home/runner/setup-pnpm/node_modules/.pnpm/pnpm@8.15.3/node_modules/pnpm/dist/node_modules/node-gyp',
.../node_modules/libpg-query install: gyp info spawn args   '-Dnode_lib_file=/home/runner/.cache/node-gyp/20.11.1/<(target_arch)/node.lib',
.../node_modules/libpg-query install: gyp info spawn args   '-Dmodule_root_dir=/home/runner/work/next-js-example-winter-2024-atvie/next-js-example-winter-2024-atvie/node_modules/.pnpm/libpg-query@16.0.1/node_modules/libpg-query',
.../node_modules/libpg-query install: gyp info spawn args   '-Dnode_engine=v8',
.../node_modules/libpg-query install: gyp info spawn args   '--depth=.',
.../node_modules/libpg-query install: gyp info spawn args   '--no-parallel',
.../node_modules/libpg-query install: gyp info spawn args   '--generator-output',
.../node_modules/libpg-query install: gyp info spawn args   'build',
.../node_modules/libpg-query install: gyp info spawn args   '-Goutput_dir=.'
.../node_modules/libpg-query install: gyp info spawn args ]
.../node_modules/libpg-query install: gyp info ok 
.../node_modules/libpg-query install: gyp info it worked if it ends with ok
.../node_modules/libpg-query install: gyp info using node-gyp@9.4.1
.../node_modules/libpg-query install: gyp info using node@20.11.1 | linux | x64
.../node_modules/libpg-query install: gyp info spawn make
.../node_modules/libpg-query install: gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
.../node_modules/libpg-query install: make: Entering directory '/home/runner/work/next-js-example-winter-2024-atvie/next-js-example-winter-2024-atvie/node_modules/.pnpm/libpg-query@16.0.1/node_modules/libpg-query/build'
.../node_modules/libpg-query install:   CC(target) Release/obj.target/nothing/../../../node-addon-api@1.7.2/node_modules/node-addon-api/src/nothing.o
.../node_modules/libpg-query install: rm -f Release/obj.target/../../../node-addon-api@1.7.2/node_modules/node-addon-api/src/nothing.a Release/obj.target/../../../node-addon-api@1.7.2/node_modules/node-addon-api/src/nothing.a.ar-file-list; mkdir -p `dirname Release/obj.target/../../../node-addon-api@1.7.2/node_modules/node-addon-api/src/nothing.a`
.../node_modules/libpg-query install: ar crs Release/obj.target/../../../node-addon-api@1.7.2/node_modules/node-addon-api/src/nothing.a @Release/obj.target/../../../node-addon-api@1.7.2/node_modules/node-addon-api/src/nothing.a.ar-file-list
.../node_modules/libpg-query install:   COPY Release/nothing.a
.../node_modules/libpg-query install:   ACTION binding_gyp_queryparser_target_prebuild_dependencies libpg_query/include/pg_query.h
.../node_modules/libpg-query install: Cloning into 'libpg_query'...
.../node_modules/libpg-query install: Note: switching to '1ec38940e5c6f09a4c1d17a46d839a881c4f2db7'.
.../node_modules/libpg-query install: You are in 'detached HEAD' state. You can look around, make experimental
.../node_modules/libpg-query install: changes and commit them, and you can discard any commits you make in this
.../node_modules/libpg-query install: state without impacting any branches by switching back to a branch.
.../node_modules/libpg-query install: If you want to create a new branch to retain commits you create, you may
.../node_modules/libpg-query install: do so (now or later) by using -c with the switch command. Example:
.../node_modules/libpg-query install:   git switch -c <new-branch-name>
.../node_modules/libpg-query install: Or undo this operation with:
.../node_modules/libpg-query install:   git switch -
.../node_modules/libpg-query install: Turn off this advice by setting config variable advice.detachedHead to false
.../node_modules/libpg-query install: HEAD is now at 1ec3894 Release 16-5.1.0
.../node_modules/libpg-query install: make[1]: Entering directory '/tmp/tmp.Gel2bVDeOp/libpg_query'
.../node_modules/libpg-query install: compiling src/pg_query.c
.../node_modules/libpg-query install: compiling src/pg_query_deparse.c
.../node_modules/libpg-query install: compiling src/pg_query_fingerprint.c
.../node_modules/libpg-query install: compiling src/pg_query_json_plpgsql.c
.../node_modules/libpg-query install: compiling src/pg_query_normalize.c
.../node_modules/libpg-query install: compiling src/pg_query_outfuncs_json.c
.../node_modules/libpg-query install: compiling src/pg_query_outfuncs_protobuf.c
.../node_modules/libpg-query install: compiling src/pg_query_parse.c
.../node_modules/libpg-query install: compiling src/pg_query_parse_plpgsql.c
.../node_modules/libpg-query install: compiling src/pg_query_readfuncs_protobuf.c
.../node_modules/libpg-query install: Warning: protoc-gen-c not found, skipping protocol buffer regeneration
.../node_modules/libpg-query install: compiling src/pg_query_scan.c
.../node_modules/libpg-query install: compiling src/pg_query_split.c
.../node_modules/libpg-query install: compiling src/postgres_deparse.c
.../node_modules/libpg-query install: compiling src/postgres/src_backend_catalog_namespace.c
.../node_modules/libpg-query install: compiling src/postgres/src_backend_catalog_pg_proc.c
.../node_modules/libpg-query install: compiling src/postgres/src_backend_commands_define.c
.../node_modules/libpg-query install: compiling src/postgres/src_backend_nodes_bitmapset.c
.../node_modules/libpg-query install: compiling src/postgres/src_backend_nodes_copyfuncs.c
.../node_modules/libpg-query install: compiling src/postgres/src_backend_nodes_equalfuncs.c
.../node_modules/libpg-query install: compiling src/postgres/src_backend_nodes_extensible.c
.../node_modules/libpg-query install: compiling src/postgres/src_backend_nodes_list.c
.../node_modules/libpg-query install: compiling src/postgres/src_backend_nodes_makefuncs.c
.../node_modules/libpg-query install: compiling src/postgres/src_backend_nodes_nodeFuncs.c
.../node_modules/libpg-query install: compiling src/postgres/src_backend_nodes_nodes.c
.../node_modules/libpg-query install: compiling src/postgres/src_backend_nodes_value.c
.../node_modules/libpg-query install: compiling src/postgres/src_backend_parser_gram.c
.../node_modules/libpg-query install: compiling src/postgres/src_backend_parser_parser.c
.../node_modules/libpg-query install: compiling src/postgres/src_backend_parser_scan.c
.../node_modules/libpg-query install: compiling src/postgres/src_backend_parser_scansup.c
.../node_modules/libpg-query install: compiling src/postgres/src_backend_storage_ipc_ipc.c
.../node_modules/libpg-query install: compiling src/postgres/src_backend_tcop_postgres.c
.../node_modules/libpg-query install: compiling src/postgres/src_backend_utils_activity_pgstat_database.c
.../node_modules/libpg-query install: compiling src/postgres/src_backend_utils_adt_datum.c
.../node_modules/libpg-query install: compiling src/postgres/src_backend_utils_adt_expandeddatum.c
.../node_modules/libpg-query install: compiling src/postgres/src_backend_utils_adt_format_type.c
.../node_modules/libpg-query install: compiling src/postgres/src_backend_utils_adt_numutils.c
.../node_modules/libpg-query install: compiling src/postgres/src_backend_utils_adt_ruleutils.c
.../node_modules/libpg-query install: compiling src/postgres/src_backend_utils_error_assert.c
.../node_modules/libpg-query install: compiling src/postgres/src_backend_utils_error_elog.c
.../node_modules/libpg-query install: compiling src/postgres/src_backend_utils_fmgr_fmgr.c
.../node_modules/libpg-query install: compiling src/postgres/src_backend_utils_init_globals.c
.../node_modules/libpg-query install: compiling src/postgres/src_backend_utils_mb_mbutils.c
.../node_modules/libpg-query install: compiling src/postgres/src_backend_utils_misc_guc_tables.c
.../node_modules/libpg-query install: compiling src/postgres/src_backend_utils_mmgr_alignedalloc.c
.../node_modules/libpg-query install: compiling src/postgres/src_backend_utils_mmgr_aset.c
.../node_modules/libpg-query install: compiling src/postgres/src_backend_utils_mmgr_generation.c
.../node_modules/libpg-query install: compiling src/postgres/src_backend_utils_mmgr_mcxt.c
.../node_modules/libpg-query install: compiling src/postgres/src_backend_utils_mmgr_slab.c
.../node_modules/libpg-query install: compiling src/postgres/src_common_encnames.c
.../node_modules/libpg-query install: compiling src/postgres/src_common_hashfn.c
.../node_modules/libpg-query install: compiling src/postgres/src_common_keywords.c
.../node_modules/libpg-query install: compiling src/postgres/src_common_kwlookup.c
.../node_modules/libpg-query install: compiling src/postgres/src_common_psprintf.c
.../node_modules/libpg-query install: compiling src/postgres/src_common_stringinfo.c
.../node_modules/libpg-query install: compiling src/postgres/src_common_wchar.c
.../node_modules/libpg-query install: compiling src/postgres/src_pl_plpgsql_src_pl_comp.c
.../node_modules/libpg-query install: compiling src/postgres/src_pl_plpgsql_src_pl_funcs.c
.../node_modules/libpg-query install: compiling src/postgres/src_pl_plpgsql_src_pl_gram.c
.../node_modules/libpg-query install: compiling src/postgres/src_pl_plpgsql_src_pl_handler.c
.../node_modules/libpg-query install: compiling src/postgres/src_pl_plpgsql_src_pl_scanner.c
.../node_modules/libpg-query install: compiling src/postgres/src_port_pg_bitutils.c
.../node_modules/libpg-query install: compiling src/postgres/src_port_pgstrcasecmp.c
.../node_modules/libpg-query install: compiling src/postgres/src_port_qsort.c
.../node_modules/libpg-query install: compiling src/postgres/src_port_snprintf.c
.../node_modules/libpg-query install: compiling src/postgres/src_port_strerror.c
.../node_modules/libpg-query install: compiling src/postgres/src_port_strlcpy.c
.../node_modules/libpg-query install: compiling vendor/protobuf-c/protobuf-c.c
.../node_modules/libpg-query install: compiling vendor/xxhash/xxhash.c
.../node_modules/libpg-query install: Warning: protoc-gen-c not found, skipping protocol buffer regeneration
.../node_modules/libpg-query install: compiling protobuf/pg_query.pb-c.c
.../node_modules/libpg-query install: ar: creating libpg_query.a
.../node_modules/libpg-query install: make[1]: Leaving directory '/tmp/tmp.Gel2bVDeOp/libpg_query'
.../node_modules/libpg-query install:   CXX(target) Release/obj.target/queryparser/src/addon.o
.../node_modules/libpg-query install:   CXX(target) Release/obj.target/queryparser/src/helpers.o
.../node_modules/libpg-query install:   CXX(target) Release/obj.target/queryparser/src/sync.o
.../node_modules/libpg-query install:   CXX(target) Release/obj.target/queryparser/src/async.o
.../node_modules/libpg-query install:   SOLINK_MODULE(target) Release/obj.target/queryparser.node
.../node_modules/libpg-query install:   COPY Release/queryparser.node
.../node_modules/libpg-query install: make: Leaving directory '/home/runner/work/next-js-example-winter-2024-atvie/next-js-example-winter-2024-atvie/node_modules/.pnpm/libpg-query@16.0.1/node_modules/libpg-query/build'
.../node_modules/libpg-query install: gyp info ok 
.../node_modules/libpg-query install: node-pre-gyp info ok 
.../node_modules/libpg-query install: Done
...
devDependencies:
...
+ libpg-query 16.0.1

@saurabh-vt
Copy link

saurabh-vt commented Feb 22, 2024

@Newbie012 I'm still getting the same error

Failed to load plugin '@ts-safeql/eslint-plugin' declared in '.eslintrc.json': /snap/core20/current/lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.34' not found

I have added "libpg-query": "16.0.1"

@wale @xegulon @karlhorky Is the issue resolved for you guys??

@wale
Copy link

wale commented Feb 22, 2024

I can confirm that it has been tested and resolved. This might be due to LD_LIBRARY_PATHS in your (seemingly) Ubuntu system, as that is linking to a snap package?

@saurabh-vt
Copy link

@wale can you run this example https://github.com/developer-vtnetzwelt/safeql-prisma-demo and check if everything is working fine.

I have glibc_2.35 installed, I want to run the safeql against the prisma migration file and not with database url

@xegulon
Copy link

xegulon commented Feb 22, 2024

The install works well with the latest version, which is good. I setup the instructions according to prisma docs with eslint, and I modified some of my queries to add errors, but I do not see warnings yet. I'll inspect later!

@wale
Copy link

wale commented Feb 23, 2024

@wale can you run this example https://github.com/developer-vtnetzwelt/safeql-prisma-demo and check if everything is working fine.

I have glibc_2.35 installed, I want to run the safeql against the prisma migration file and not with database url

You need to explicitly install libpg-query@16.0.1

@saurabh-vt
Copy link

@wale I have installed it already but still not working

@wale
Copy link

wale commented Feb 23, 2024

Due to how the versions in the libpg-query NPM package are set up, you must explicitly install libpg-query@16.0.2, like npm install libpg-query@16.0.2.

This statement in your package.json will not work.

https://github.com/developer-vtnetzwelt/safeql-prisma-demo/blob/3b048042f2959ab88ce436601691426e8220ebfc/package.json#L23

@saurabh-vt
Copy link

@wale git code was not updated, i have updated it now , please check now

@wale
Copy link

wale commented Feb 23, 2024

You need a database URL so SafeQL can infer metadata and understand the database structure, otherwise the URL falls back to a default value, see the relevant documentation.

You can see it's asking for a postgres user here:
image

That's because it falls back to the connection URL of postgres://postgres:postgres@localhost:5432/postgres.

@karlhorky
Copy link
Collaborator

@developer-vtnetzwelt @Newbie012 now that this issue has been confirmed to be resolved, can this issue be closed?

@Newbie012
Copy link
Collaborator

I believe so. @developer-vtnetzwelt can you test it with the latest version of libpg-query?

@Newbie012
Copy link
Collaborator

I'll close this issue for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

6 participants