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

unsupported expression "auth.uid" #8643

Open
kauly opened this issue Nov 17, 2024 · 1 comment
Open

unsupported expression "auth.uid" #8643

kauly opened this issue Nov 17, 2024 · 1 comment

Comments

@kauly
Copy link

kauly commented Nov 17, 2024

Operating System

Ubuntu

Environment (if applicable)

Nodejs 20

Firebase SDK Version

11.0.2

Firebase SDK Product(s)

DataConnect

Project Tooling

Nextjs

Detailed Problem Description

Im trying to integrate Firebase auth with data connect and according to the docs we can use the "auth.uid" directive but its not working on localhost with emulators. Also, it took me sometime to find the cause of the error because in the browser the error cause is "connector id not found".

Error:

I1117 12:31:32.449027   26009 control.go:45] [engine.Service /emulator/city-watch-data-connect 8955] UpdateSchema(): done sources: schema/schema.gql [333B] 
I1117 12:31:32.450023   26009 service.go:130] Failed to load latest connectors: connector/mutations.gql:10: mutation.AddOrder.order_insert (data.userId_expr: UUID_Expr): unsupported expression "auth.uid" (currently only "uuidV4()" is supported) 

Steps and code to reproduce issue

Mutation:

mutation AddOrder(
  $lat: Float!
  $lng: Float!
  $street: String
  $streetNumber: String
  $postalCode: String
  $neighborhood: String
  $observations: String
) @auth(level: USER) {
  order_insert(
    data: {
      userId_expr: "auth.uid"
      lat: $lat
      lng: $lng
      street: $street
      streetNumber: $streetNumber
      postalCode: $postalCode
      neighborhood: $neighborhood
      observations: $observations
    }
  )
}

Schema:

type User @table {
  username: String!
  auth: String @col(name: "user_auth") @default(expr: "auth.uid")
}

type Order @table {
  user: User
  lat: Float!
  lng: Float!
  street: String
  streetNumber: String
  postalCode: String
  neighborhood: String
  observations: String
  createdAt: Timestamp! @default(expr: "request.time")
}
@kauly kauly added new A new issue that hasn't be categoirzed as question, bug or feature request question labels Nov 17, 2024
@google-oss-bot
Copy link
Contributor

I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.

@jbalidiong jbalidiong added api: auth needs-attention and removed needs-triage new A new issue that hasn't be categoirzed as question, bug or feature request labels Nov 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants