1

For some reason, I don't know, my cloud function isn't working with the error being:

!  functions: failed to update function projects/jungschar-website/locations/us-central1/functions/createUser
Failed to update function projects/jungschar-website/locations/us-central1/functions/createUser

Functions deploy had errors with the following functions:
        createUser(us-central1)
i  functions: cleaning up build files...

Error: There was an error deploying functions

index.ts

import * as functions from "firebase-functions";
import admin = require("firebase-admin");
admin.initializeApp();

const db = admin.firestore();

export const createUser = functions.auth.user().onCreate((user) => {
  db.doc("users/" + user.uid).set({
    uid: user.uid,
    email: user.email,
    isAdmin: false,
  });
});

firebase-debug.log
https://paste.gg/p/anonymous/827e6ed903df4ad097e6551bd859884f

Please help me. I've been googling for so long

1 Answer 1

1
import * as functions from "firebase-functions";
import admin = require("firebase-admin");
admin.initializeApp();

// const db = admin.firestore();
export const createUser = functions.auth.user().onCreate((user) => {
  admin.firestore().doc("users/" + user.uid).set({
    uid: user.uid,
    email: user.email,
    isAdmin: false,
  });
});

This works

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.