Skip to content

[cloud_functions] Unauthenticated error on .call() #2374

Closed
@ishtms

Description

@ishtms

I am trying to call a Callable function using the cloud_functions package. I've tried using the example code as well and still getting the same error -

PlatformException(functionsError, Cloud function failed with exception., {code: UNAUTHENTICATED, details: null, message: UNAUTHENTICATED})

The firebase app is on spark plan (Just in case if that matters?). I've tried using Node version 8 and 10, but no luck.

The dart code -

CloudFunctions(region: 'asia-east2').getHttpsCallable(functionName: 'addUser').call({ "name": "Test", "email": "abc@example.com" })

Callable function's code -

exports.addUser = functions.region('asia-east2').https.onCall((data, context) => { const users = admin.firestore().collection('users'); return users.add({ name: data["name"], email: data["email"] }); });

Aditional info:

Device - Asus Zenfone 5z

Flutter Doctor:
[√] Flutter (Channel stable, v1.12.13+hotfix.8, on Microsoft Windows [Version 10.0.18362.720], locale en-US)
[√] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
[√] Android Studio (version 3.5)
[√] VS Code (version 1.44.1)
[√] Connected device (1 available)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions