Unable to deploy functions with Typescript
See original GitHub issueVersion info
firebase-functions: 2.1.0
firebase-tools: 6.1.2
firebase-admin: 6.4.0
Test case
When using Typescript together with firebase functions I’m unable to deploy any code because of the following error:
Error: mod.hasOwnProperty is not a function
Typescript version: 3.2.2
Steps to reproduce
functions/index.ts
import * as functions from 'firebase-functions'
import * as admin from 'firebase-admin';
admin.initializeApp(functions.config().firebase);
admin.firestore().settings({ timestampsInSnapshots: true });
const env = functions.config();
...
Run $ firebase deploy --only functions
Result
✔ functions: Finished running predeploy script.
i functions: ensuring necessary APIs are enabled...
✔ functions: all necessary APIs are enabled
i functions: preparing functions directory for uploading...
Error: mod.hasOwnProperty is not a function
Were you able to successfully deploy your functions?
No. I got the following error message - Error: mod.hasOwnProperty is not a function
Expected behavior
Functions should get deployed.
Actual behavior
Error: mod.hasOwnProperty is not a function
Issue Analytics
- State:
- Created 5 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Firebase function deploy error in a typescript project with ...
Hi there I have an issue deploying my typescript express app to firebase via firebase-tools when that project contains another typescript ...
Read more >Use TypeScript for Cloud Functions - Firebase
Following instructions in this guide, you can migrate an existing JavaScript project to TypeScript and continue deploying functions using a predeploy hook ...
Read more >Troubleshooting Cloud Functions - Google Cloud
Function deployment fails due to Cloud Build not supporting VPC-SC. Cloud Functions uses Cloud Build to build your source code into a runnable...
Read more >Error when deploying a Firebase cloud function - Google Groups
I also think that the words "failed create image cache" mean that it's related ... I'm writing my cloud functions in Typescript and...
Read more >Cloud Build error when trying to update ... - Issue Tracker
Every single one is failing. I'm using Typescript to write my functions, with CLI deployment using the command 'firebase deploy'.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@mlejva I took a look at the error message that you are getting, and I believe it is coming from extractTriggers.js (https://github.com/firebase/firebase-tools/blob/master/src/extractTriggers.js) in firebase-tools. This code is run when you ‘firebase deploy’ in order to find the names of your functions from what you export in index.ts. firebase deploy expects that src/index.ts is only exporting functions created via firebase-functions (or custom functions written to the same spec). You shouldn’t export other things in your index.ts file. Hopefully this helps! I’m going to close this since its not an issue with our codebase, but I’m happy to clarify any other questions you may have.
I just found that some bundlers/optimizers can remove the
__proto__
functions of the Object and that will breakfirebase-tools
logic. See firebase/firebase-tools#1687