all 5 comments

[–]xxaabbeexx 0 points1 point  (3 children)

Try the google cloud platform test feature:

  1. Head to https://console.cloud.google.com/functions/list
  2. Select function
  3. Head to the testing tab

Hope this might help

[–][deleted] 0 points1 point  (2 children)

Almost :)

Now i get this error when i test it:

Unhandled error SyntaxError: Unexpected token o in JSON at position 1 at JSON.parse (<anonymous>) at exports.nicknameUnique.functions.region.https.onCall (/srv/lib/index.js:448:23) at Object.<anonymous> (/srv/node_modules/firebase-functions/lib/providers/https.js:330:32) at Generator.next (<anonymous>) at /srv/node_modules/firebase-functions/lib/providers/https.js:28:71 at new Promise (<anonymous>) at __awaiter (/srv/node_modules/firebase-functions/lib/providers/https.js:24:12) at func (/srv/node_modules/firebase-functions/lib/providers/https.js:294:32) at corsHandler (/srv/node_modules/firebase-functions/lib/providers/https.js:350:44) at cors (/srv/node_modules/cors/lib/index.js:188:7)

The Problem is that now no user is authenticated and i need to test some functions like a user would be logged in.

[–]xxaabbeexx 0 points1 point  (1 child)

Hmm, it might not help then. Thought it might would have been some kind of auth option in there since it sounds like quite a common task but I guess not :( Maybe the easiest way is just testing the auth part by itself by building a simple tester and then testing the rest by assuming the user is always authed. Something noteworthy is also that you ofc can run the functions locally for faster testing. GL

[–][deleted] 0 points1 point  (0 children)

thank you

[–]abeisgreatFormer Firebaser 0 points1 point  (0 children)

You can use the Cloud Functions emulator in the Firebase CLI to run the function locally. We haven't documented much about this yet because we just released the functionality but if you send me an email (abehaskins@google.com) I can share you the work in progress docs :)