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

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

Closed
ishtms opened this issue Apr 15, 2020 · 5 comments
Closed

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

ishtms opened this issue Apr 15, 2020 · 5 comments
Labels
blocked: customer-response Waiting for customer response, e.g. more information was requested. plugin: functions type: bug Something isn't working

Comments

@ishtms
Copy link

ishtms commented Apr 15, 2020

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)

@ishtms ishtms added the type: bug Something isn't working label Apr 15, 2020
@TahaTesser
Copy link

Hi @Ishtmeet-Singh
can you please provide your flutter run --verbose from root of your project?
Thank you

@TahaTesser TahaTesser added the blocked: customer-response Waiting for customer response, e.g. more information was requested. label Apr 16, 2020
@ishtms
Copy link
Author

ishtms commented Apr 17, 2020

@TahaTesser Here's what I get after running flutter run --verbose

> flutter run --verbose
[  +52 ms] executing: [C:\Program Files\flutter\] git -c log.showSignature=false log -n 1 --pretty=format:%H
[  +67 ms] Exit code 0 from: git -c log.showSignature=false log -n 1 --pretty=format:%H
[   +1 ms] 0b8abb4724aa590dd0f429683339b1e045a1594d
[        ] executing: [C:\Program Files\flutter\] git describe --match v*.*.* --first-parent --long --tags
[  +43 ms] Exit code 0 from: git describe --match v*.*.* --first-parent --long --tags
[        ] v1.12.13+hotfix.8-0-g0b8abb472
[   +7 ms] executing: [C:\Program Files\flutter\] git rev-parse --abbrev-ref --symbolic @{u}
[  +34 ms] Exit code 0 from: git rev-parse --abbrev-ref --symbolic @{u}
[   +1 ms] origin/stable
[        ] executing: [C:\Program Files\flutter\] git ls-remote --get-url origin
[  +33 ms] Exit code 0 from: git ls-remote --get-url origin
[   +1 ms] https://github.com/flutter/flutter.git
[+3892 ms] executing: [C:\Program Files\flutter\] git rev-parse --abbrev-ref HEAD
[  +35 ms] Exit code 0 from: git rev-parse --abbrev-ref HEAD
[        ] stable
[ +124 ms] executing: C:\Users\Ishtmeet\AppData\Local\Android\sdk\platform-tools\adb.exe devices -l
[  +23 ms] Exit code 0 from: C:\Users\Ishtmeet\AppData\Local\Android\sdk\platform-tools\adb.exe devices -l
[        ] List of devices attached
[   +7 ms] No supported devices connected.
[   +9 ms] "flutter run" took 198ms.

#0      throwToolExit (package:flutter_tools/src/base/common.dart:28:3)
#1      RunCommand.validateCommand (package:flutter_tools/src/commands/run.dart:289:7)
<asynchronous suspension>
#2      FlutterCommand.verifyThenRunCommand (package:flutter_tools/src/runner/flutter_command.dart:590:11)
#3      FlutterCommand.run.<anonymous closure> (package:flutter_tools/src/runner/flutter_command.dart:515:33)
<asynchronous suspension>
#4      AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:146:29)
#5      _rootRun (dart:async/zone.dart:1126:13)
#6      _CustomZone.run (dart:async/zone.dart:1023:19)
#7      _runZoned (dart:async/zone.dart:1518:10)
#8      runZoned (dart:async/zone.dart:1465:12)
#9      AppContext.run (package:flutter_tools/src/base/context.dart:145:18)
#10     FlutterCommand.run (package:flutter_tools/src/runner/flutter_command.dart:505:20)
#11     CommandRunner.runCommand (package:args/command_runner.dart:197:27)
#12     FlutterCommandRunner.runCommand.<anonymous closure>
(package:flutter_tools/src/runner/flutter_command_runner.dart:413:21)
<asynchronous suspension>
#13     AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:146:29)
#14     _rootRun (dart:async/zone.dart:1126:13)
#15     _CustomZone.run (dart:async/zone.dart:1023:19)
#16     _runZoned (dart:async/zone.dart:1518:10)
#17     runZoned (dart:async/zone.dart:1465:12)
#18     AppContext.run (package:flutter_tools/src/base/context.dart:145:18)
#19     FlutterCommandRunner.runCommand (package:flutter_tools/src/runner/flutter_command_runner.dart:364:19)
#20     CommandRunner.run.<anonymous closure> (package:args/command_runner.dart:112:25)
#21     new Future.sync (dart:async/future.dart:224:31)
#22     CommandRunner.run (package:args/command_runner.dart:112:14)
#23     FlutterCommandRunner.run (package:flutter_tools/src/runner/flutter_command_runner.dart:250:18)
#24     run.<anonymous closure>.<anonymous closure> (package:flutter_tools/runner.dart:63:22)
#25     _rootRun (dart:async/zone.dart:1126:13)
#26     _CustomZone.run (dart:async/zone.dart:1023:19)
#27     _runZoned (dart:async/zone.dart:1518:10)
#28     runZoned (dart:async/zone.dart:1502:12)
#29     run.<anonymous closure> (package:flutter_tools/runner.dart:61:18)
<asynchronous suspension>
#30     AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:146:29)
#31     _rootRun (dart:async/zone.dart:1126:13)
#32     _CustomZone.run (dart:async/zone.dart:1023:19)
#33     _runZoned (dart:async/zone.dart:1518:10)
#34     runZoned (dart:async/zone.dart:1465:12)
#35     AppContext.run (package:flutter_tools/src/base/context.dart:145:18)
#36     runInContext (package:flutter_tools/src/context_runner.dart:64:24)
#37     run (package:flutter_tools/runner.dart:50:10)
#38     main (package:flutter_tools/executable.dart:65:9)
#39     main (file:///C:/Program%20Files/flutter/packages/flutter_tools/bin/flutter_tools.dart:8:3)
#40     _startIsolate.<anonymous closure> (dart:isolate-patch/isolate_patch.dart:305:32)
#41     _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:174:12)

@ishtms
Copy link
Author

ishtms commented Apr 17, 2020

I am using VS Code's flutter extension to run the project.

@Ehesp
Copy link
Member

Ehesp commented Apr 18, 2020

What version of the Firebase CLI are you uploading the functions with?

See this page: https://firebase.google.com/docs/functions/callable :

image

@ishtms
Copy link
Author

ishtms commented Apr 20, 2020

@Ehesp Thank you very much. I was using 7.3.1. Upgrading solved the issue for me.

@ishtms ishtms closed this as completed Apr 20, 2020
@firebase firebase locked and limited conversation to collaborators Aug 1, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
blocked: customer-response Waiting for customer response, e.g. more information was requested. plugin: functions type: bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants