dosco / graphjin

GraphJin - Build NodeJS / GO APIs in 5 minutes not weeks

Home Page:https://graphjin.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Init failed due to allow-list "queries" directory missing even if `DisableAllowList=true` and `Production=false`

f-ld opened this issue · comments

What version of GraphJin are you using?

Module v0.20.23 integrated in my app

Have you tried reproducing the issue with the latest release?

Actually this is when going from v0.20.20 to v0.20.23 that the issue appeared

What is the hardware spec (RAM, OS)?

Unrelated, has not changed between "working" and "not working" use cases

Steps to reproduce the issue (config used to run GraphJin).

I would say use graphjin in NON-production mode with Allow list disabled
Example init:

	gj, err := graphjin.NewGraphJin(&graphjin.Config{
		Debug:            debug,
		DBType:           "mysql",
		Blocklist:        []string{""},
		DisableAllowList: true,
		DefaultLimit:     5000,
	}, db)

Expected behaviour and actual result.

Expected: no regression changing version
Actual: got an error on start:

allow list: open /app/bin/config/queries: no such file or directory

-> even if disabled, module tries to open allow list.

A quick investigation (I haven't checked code in details) took me to this commeit from v0.20.22

Workaround

Create the missing directory (it was likely created automatically in v0.20.20?)
In my case, using kubernetes, using a volume:

      ...
      containers:
        ...
        volumeMounts:
          - name: graphjin-queries-allow-list
            mountPath: /app/bin/config/queries
      volumes:
        - name: graphjin-queries-allow-list
          emptyDir: {}
commented

How are you using GraphJin without the allowlist are you allowing clients to run any random query? I'll work on a fix for this however the new REST endpoint allows you to create .graphql files in the queries folder and then you can use them with the REST api /api/v1/rest/queryFileName