Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Express & Angular Universal : undefined error with cloud functions #484

Closed
muffinrecon opened this issue Sep 29, 2017 · 6 comments
Closed
Assignees

Comments

@muffinrecon
Copy link

i  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);
@muffinrecon muffinrecon changed the title Error occured while parsing your function triggers : undefined Express & Angular Universal : undefined error with cloud functions Sep 29, 2017
@laurenzlong laurenzlong self-assigned this Oct 3, 2017
@laurenzlong
Copy link
Contributor

@muffinrecon Can you tell me what your firebase-tools version is? When you run "firebase --version" what does it print out?

@kartikgreen
Copy link

II have the same issue. My version is 3.13.0

@hiepxanh
Copy link

hiepxanh commented Oct 13, 2017

-repo here: functions

image
without that line: functions serve successful
with that line :

! functions: Failed to load functions source code. Ensure that you have the latest SDK by running npm i --save firebase-functions inside the functions directory.
! functions: Error from emulator. FirebaseError: Error occurred while parsing your function triggers.
undefined
image

I don't know I already deploy successful but something change and I got this error

  1. is that problem about 'require()' or tsconfig ?
    image

@hiepxanh
Copy link

hiepxanh commented Oct 13, 2017

take me 5 hours, add:

import 'reflect-metadata';
problem gone.

Reason:
I'm not using firebase serve --only functions , instead of that, I'm running node 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
image

ACTUALLY PROBLEM
image

@nnennajohn
Copy link

Thanks for this @hiepxanh

@thechenky
Copy link
Contributor

Closing for inactivity.

bkendall pushed a commit that referenced this issue Sep 19, 2019
* no longer validate empty optional params

* adds unit tests for validating optional params

* combines if statement to 1 line

* typo fix
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants