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

dataconnect @auth directive - role based auth expression with tokens doesnt work. #7944

Closed
artanisdesign opened this issue Nov 13, 2024 · 4 comments
Labels

Comments

@artanisdesign
Copy link

Environment info

firebase-tools: 13.25.0

**Platform: mac **

Test case

mutation createItem( $title: String! ) @auth(expr: "auth.token.isAdmin == true") { item_insert( data: { title: $title } ) }

Steps to reproduce

I run this mutation locally from data connect execution, where i do set authentication and variables too.

Expected behavior

add item only when my role is admin.

Actual behavior

weird error:

mutation, createItem On @auth: invalid expression ("auth.token.isAdmin == true"): ERROR: <input>:1:5: unexpected failed resolution of 'celenv.AuthUserInfo'
 | auth.token.isAdmin == true
 | ....^

that only happens locally. but because of this error i can not deploy to production.

@artanisdesign artanisdesign changed the title @auth directive - role based auth expression with tokens doesnt work. data-connect @auth directive - role based auth expression with tokens doesnt work. Nov 13, 2024
@artanisdesign artanisdesign changed the title data-connect @auth directive - role based auth expression with tokens doesnt work. dataconnect @auth directive - role based auth expression with tokens doesnt work. Nov 13, 2024
@argzdev argzdev added api: dataconnect Issues related to dataconnect type: bug and removed type: bug labels Nov 14, 2024
@aalej
Copy link
Contributor

aalej commented Nov 15, 2024

Thanks for the report @artanisdesign. It looks like the error only occurs when running the mutation locally. I tried performing the mutation on a production environment and it does not raise any errors. I'll raise this to our engineering team to see what we can do here.

@artanisdesign
Copy link
Author

hi @aalej yea, i noticed that part - it only occurs locally-, its in the original issue too. while from admin or console i can do it, i cant deploy the named mutation to do console.. so obviously i cant use that from my client code.

@joehan
Copy link
Contributor

joehan commented Nov 19, 2024

Hey @artanisdesign - thanks for reporting this and apologies for the inconvenience. This should be fixed by #7968, which will go out in the next release this afternoon.

@joehan joehan closed this as completed Nov 19, 2024
@artanisdesign
Copy link
Author

artanisdesign commented Nov 19, 2024 via email

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

4 participants