I’m trying to set up a Zapier script that creates new Firebase users. I’ve put together some code based on the Firebase JavaScript docs, but I’m running into issues. When I test my zap, I get this error: ‘SyntaxError: Cannot use import statement outside a module.’
Here’s a simplified version of what I’m attempting:
I’ve actually implemented Firebase user creation in Zapier recently, and I can share some insights. The key is to use the ‘firebase-admin’ SDK instead of the client-side Firebase SDK. Here’s a rough outline of what worked for me:
Install the ‘firebase-admin’ package in your Zapier app.
Initialize the admin SDK using a service account key (you’ll need to generate this in your Firebase console).
Use the admin SDK’s auth().createUser() method to create new users.
The code structure would look something like this:
Remember to securely store your service account key in Zapier. This approach bypasses the module import issues and gives you full admin privileges for user management.
hey there! i’ve run into this before. zapier doesn’t support ES6 imports, so you gotta use require() instead. also, make sure you’re using the right firebase sdk for zapier - they have some specific packages. try checking out zapier’s firebase integration docs, they might have some example code that’ll help ya out!
I’ve worked with Firebase in Zapier before, and there’s a simpler way to approach this. Instead of using the Firebase SDK directly, you can leverage Zapier’s built-in Firebase integration. It’s much easier to set up and doesn’t require any custom code.
To create a new user, you can use the ‘Create User’ action in the Firebase integration. You just need to connect your Firebase account to Zapier, then configure the action with the email and password fields. Zapier handles all the authentication and API calls behind the scenes.
This method is more reliable and easier to maintain. Plus, it automatically handles error cases and retries if needed. If you need more advanced functionality, you might still need custom code, but for basic user creation, the built-in integration should suffice.