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

Multi-Tenant domain error: Filter [tenantId] parameter [tenantId] value not set" #148

Open
wureka opened this issue Jun 28, 2024 · 0 comments

Comments

@wureka
Copy link

wureka commented Jun 28, 2024

Environment:

  • Grails 6.2.0 (JDK-17), Grails 5.3.3 (JDK-11)
  • gorm-graphql-plugin 3.0.0

I have refered your example in https://github.com/grails/gorm-graphql/blob/4.0.x/examples/grails-tenant-app/grails-app/domain/grails/tenant/app/User.groovy

My Grails app is a multi-tenant system. The relevant files are as below
application.yml (only key portion):


grails:
    profile: vue
    codegen:
        defaultPackage: worker.order
    gorm:
        failOnError: true
        reactor:
            events: false
        multiTenancy:
            mode: DISCRIMINATOR # SCHEMA, DATABASE, DISCRIMINATOR
            tenantResolverClass: com.workerorder.multitenancy.CurrentUserByJwtTenantResolver

domain TenantFunc:


class TenantFunc  implements MultiTenant<TenantFunc> {
    String vueComponentName
    String funcname
    int displayorder = 0
    String position
    boolean active
    String updatedBy
    String createdBy
    Date dateCreated
    Date lastUpdated

    String tenantName
    static graphql = true
    static mapping = {
        tenantId name: 'tenantName'
        active  default:'true'
    }
    
    static constraints = {
        tenantName      maxSize: FieldLen.TENANT_NAME, index:'tenant_all_func_tenant_func'
        vueComponentName    maxSize: 60, unique: ['tenantName']
        funcname            maxSize: 100, unique: ['tenantName']
        position            maxSize: 20
    }

    static graphql = true
}

graphql in http://localhost:8080/graphql/browser :

query {
  tenantFuncList {
    id
    
  }
}

result:


{
  "data": {
    "tenantFuncList": null
  },
  "errors": [
    {
      "message": "Exception while fetching data (/tenantFuncList) : Filter [tenantId] parameter [tenantId] value not set",
      "errorType": "DataFetchingException",
      "locations": [
        {
          "line": 2,
          "column": 3
        }
      ]
    }
  ]
}

How to solve this error ? Thanks

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

No branches or pull requests

1 participant