Firebase Deploy Error: "Mux is not a constructor"
See original GitHub issueI’m having an issue when trying to deploy code with the newest Mux version (3.0.2 – using typescript types). Note: previous Mux versions (before Typescript support worked fine)
I’m deploying my code to Firebase’s cloud functions via the firebase deploy --only functions
command.
The code is able to build correctly without errors, but Firebase’s deploy command will throw the following:
Error: Error occurred while parsing your function triggers.
TypeError: Mux is not a constructor
at Object.<anonymous> (/mnt/l/projects/my_fb_project/backend/functions/lib/index.js:44:57)
at Module._compile (internal/modules/cjs/loader.js:778:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
at Module.load (internal/modules/cjs/loader.js:653:32)
at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
at Function.Module._load (internal/modules/cjs/loader.js:585:3)
at Module.require (internal/modules/cjs/loader.js:692:17)
at require (internal/modules/cjs/helpers.js:25:18)
at /mnt/l/projects/my_fb_project/backend/functions/node_modules/firebase-tools/lib/triggerParser.js:15:15
at Object.<anonymous> (/mnt/l/projects/my_fb_project/backend/functions/node_modules/firebase-tools/lib/triggerParser.js:53:3)
Issue Analytics
- State:
- Created 3 years ago
- Reactions:2
- Comments:9 (2 by maintainers)
Top Results From Across the Web
Firebase is not a constructor error(using firebase with react)
When ever i am running code it gives me "Firebase is not a constructor". also tried with componentWillMount but nothing works. I try...
Read more >Manage functions | Cloud Functions for Firebase - Google
To avoid errors, change a function's trigger type by this procedure: Modify the source code to include a new function with the desired...
Read more >centiment package - github.com/elithrar/centiment - Go Packages
TODO(matt): Create a NewServer constructor -> call srv.Run() ... It will return a nil value and no error if no record was found....
Read more >flutter/flutter_web - Gitter
https://medium.com/flutter-community/flutter-create-and-deploy-a-website-from ... -on-textfields-not-working-flutter-web When tabbing through a form on web, ...
Read more >Stripe | (p)retired
An application user will interact with Firebase Authentication, logging in using ... minor errors and the Golang server code referenced an outdated module....
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 FreeTop 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
Top GitHub Comments
I temporarily worked around this by using
instead of the standard ts
import Mux from '@mux/mux-node'
. Inspecting the typescript output, it produces:and unsurprisingly,
mux_node_1.default
is undefined. Manually confirming this,require('@mux/mux-node').default
is undefined.I’m guessing this project has its exports misconfigured, specifically default exports should be
module.exports.default =
. I sent a pull request to add an ES6 default export.Thank you everyone. Looks like it is working now