Express & Angular Universal : undefined error with cloud functions
See original GitHub issuei deploying functions
i functions: ensuring necessary APIs are enabled...
i runtimeconfig: ensuring necessary APIs are enabled...
+ runtimeconfig: all necessary APIs are enabled
+ functions: all necessary APIs are enabled
i functions: preparing functions directory for uploading...
Error: Error occurred while parsing your function triggers.
undefined
Not sure what this means. it doesn’t even tell me what’s undefined.
When I take out this code though, it works. I’m trying to use angular platform server onto my app,
require('zone.js/dist/zone-node');
const express = require('express');
const path = require('path')
const renderModuleFactory = require('@angular/platform-server').renderModuleFactory;
const AppServerModuleNgFactory = require('./dist-ssr/main.bundle').AppServerModuleNgFactory;
const index = require('fs').readFileSync(path.resolve(__dirname, './dist/index.html'), 'utf8');
const app = express();
app.get('/', (req, res) => {
renderModuleFactory(AppServerModuleNgFactory, { document: index, url: '/' })
.then(html => {
res.send(html);
})
.catch(err => {
console.log(err)
});
});
exports.ssr = functions.https.onRequest(app);
Issue Analytics
- State:
- Created 6 years ago
- Reactions:1
- Comments:6 (2 by maintainers)
Top Results From Across the Web
Cloud functions throws error after migrating Angular Universal ...
I found someone who wrote this online: 'I solved issue with my ssr setup by making firebase depenencies "external" in firebase config for...
Read more >Troubleshooting Cloud Functions - Google Cloud
Make sure you specify the name of your function correctly. You can always check using gcloud functions call which returns the correct 404...
Read more >Angular Universal: ReferenceError: window is not defined
This error can be caused by a reference to the Window object if you are rendering your application from a server like Node.js....
Read more >angular/universal - Gitter
I found a solution, it was an issue with universal and angular 8, ... I've been trying to deploy an Angular Universal app...
Read more >Call functions via HTTP requests | Cloud Functions for Firebase
Caution: New HTTP and HTTP callable functions deployed with any Firebase CLI lower than version 7.7.0 are private by default and throw HTTP...
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
take me 5 hours, add:
Reason: I’m not using
firebase serve --only functions
, instead of that, I’m runningnode index.js
at functions folder, it give much better log, after that, I detected this error because lack of metadata. finally, I got that line.BAD LOGGING
ACTUALLY PROBLEM
Thanks for this @hiepxanh