Open EMokro opened 1 year ago
This issue does not seem to follow the issue template. Make sure you provide all the required information.
Gathering further information I came accross this Issue. https://github.com/firebase/firebase-tools/issues/4538
It is the same error, but I don't use the functions.config()
in my project.
@TheIronDev could you give me an update? I need to deploy the website at the beginning of next year.
HI @EMokro,
I'm super sorry about the delay, this issue fell through my radar.
Is there a repo you could share where this is being reproduced? Or at the very least, do you have the output of what functions.yml
is being produced?
Also, did you use webframeworks in conjunction with this project?
Thank you! Tyler
Getting this too, how can I grab functions.yaml
? @TheIronDev Seems to only be generated during runtime and I can't find it anywhere on Mac.
Here's my debug trace:
[2] [2022-12-22T00:49:33.690Z] Validating nodejs source
[2] [2022-12-22T00:49:34.803Z] > [functions] package.json contents: {
[2] "name": "...",
[2] "version": "1.0.0",
[2] "description": "...!",
[2] "main": "build/api/index.js",
[2] "homepage": "/",
[2] "author": "...",
[2] "license": "MIT",
[2] "private": false,
[2] "scripts": {
[2] "start": "concurrently --kill-others \"yarn build:api --watch | yarn serve\" \"yarn start:ext\" && yarn clean",
[2] "start:api": "yarn build:api && concurrently --kill-others \"tsc -w\" \"tsc-alias -w\" \"yarn serve\" && yarn clean",
[2] "start:ext": "yarn env ext && GENERATE_SOURCEMAP=false NODE_DEBUG=http APP=ext react-app-rewired start",
[2] "start:web": "yarn env web && GENERATE_SOURCEMAP=false NODE_DEBUG=http APP=web react-app-rewired start",
[2] "build": "yarn build:api && yarn build:ext && yarn build:web",
[2] "build:api": "yarn env api && tsc && tsc-alias",
[2] "build:ext": "yarn env ext && GENERATE_SOURCEMAP=false APP=ext INLINE_RUNTIME_CHUNK=false react-app-rewired build && ./pack_ext.sh",
[2] ...
[2] },
[2] "dependencies": {
[2] "@emotion/react": "^11.10.4",
[2] "@google-cloud/firestore": "^5.0.2",
[2] "@iconify/react": "^4.0.1",
[2] "@tanstack/react-query": "^4.16.0",
[2] "@trpc/client": "^10.0.0",
[2] "@trpc/react-query": "^10.0.0",
[2] "@trpc/server": "^10.0.0",
[2] "@types/node": "18.11.17",
[2] "@types/react": "18.0.26",
[2] "@types/react-dom": "18.0.9",
[2] "beautiful-react-hooks": "^3.11.2",
[2] "classnames": "^2.3.2",
[2] "cross-fetch": "^3.1.5",
[2] "dotenv": "^16.0.3",
[2] "express": "^4.17.3",
[2] "firebase": "^9.15.0",
[2] "firebase-admin": "^11.4.0",
[2] "firebase-functions": "^4.1.1",
[2] "http-errors": "^2.0.0",
[2] "http-status-codes": "^2.2.0",
[2] "jsonwebtoken": "^8.5.1",
[2] "lodash": "^4.17.21",
[2] "mixpanel": "^0.17.0",
[2] "openai": "^3.1.0",
[2] "polyfill-object.fromentries": "^1.0.1",
[2] "postcss-cli": "^10.1.0",
[2] "react": "^18.2.0",
[2] "react-dom": "^18.2.0",
[2] "react-hook-form": "^7.41.0",
[2] "react-lazily": "^0.9.1",
[2] "react-linkedin-login-oauth2": "^2.0.1",
[2] "react-phone-input-2": "^2.15.1",
[2] "react-router": "^6.2.2",
[2] "react-router-dom": "^6.4.1",
[2] "react-spinners": "^0.13.7",
[2] "react-use": "^17.4.0",
[2] "react-use-cookie": "^1.4.0",
[2] "react-widgets": "^5.8.4",
[2] "react-widgets-tailwind": "^1.1.5",
[2] "style-loader": "^3.3.1",
[2] "superjson": "1.9.1",
[2] "typescript": "4.9.4",
[2] "typewriter-effect": "^2.19.0",
[2] "usehooks-ts": "^2.9.1",
[2] "uuid": "^9.0.0",
[2] "validator": "^13.7.0",
[2] "zod": "^3.18.0"
[2] },
[2] "pre-commit": [
[2] "precommit"
[2] ],
[2] "devDependencies": {
[2] "@types/chrome": "^0.0.204",
[2] "@types/classnames": "^2.3.1",
[2] "@types/core-js": "^2.5.5",
[2] "@types/express": "^4.17.13",
[2] "@types/firebase": "^3.2.1",
[2] "@types/globalthis": "^1.0.1",
[2] "@types/http-errors": "^2.0.1",
[2] "@types/http-status-codes": "^1.2.0",
[2] "@types/lodash": "^4.14.191",
[2] "@types/node": "^18.0.0",
[2] "@types/node-cache": "^4.2.5",
[2] "@types/passport": "^1.0.11",
[2] "@types/passport-linkedin-oauth2": "^1.5.3",
[2] "@types/query-string": "^6.3.0",
[2] "@types/react": "^18.0.14",
[2] "@types/react-dom": "^18.0.5",
[2] "@types/uuid": "^9.0.0",
[2] "@types/validator": "^13.7.10",
[2] "@typescript-eslint/eslint-plugin": "^5.33.0",
[2] "@typescript-eslint/parser": "^5.33.0",
[2] "autoprefixer": "^10.4.13",
[2] "concurrently": "^7.0.0",
[2] "eslint": "^8.26.0",
[2] "globalthis": "^1.0.3",
[2] "kill-port": "^1.6.1",
[2] "postcss": "^8.4.20",
[2] "pre-commit": "^1.2.2",
[2] "prettier": "^2.7.1",
[2] "prettxier-plugin-tailwindcss": "^0.1.13",
[2] "react-app-alias": "^2.2.2",
[2] "react-app-rewire-postcss": "^3.0.2",
[2] "react-app-rewired": "^2.2.1",
[2] "react-dev-utils": "^12.0.1",
[2] "react-scripts": "^5.0.1",
[2] "tailwindcss": "^3.2.4",
[2] "tsc-alias": "^1.8.2",
[2] "typescript": "^4.8.3"
[2] },
[2] "browserslist": [
[2] ">0.2%",
[2] "not dead",
[2] "not op_mini all"
[2] ],
[2] "engines": {
[2] "node": "16"
[2] }
[2] }
[2] [2022-12-22T00:49:34.803Z] Building nodejs source
[2] i functions: Loaded environment variables from .env.
[2] [2022-12-22T00:49:34.805Z] Could not find functions.yaml. Must use http discovery
[2] [2022-12-22T00:49:34.931Z] Serving at port 9007
[2]
[2] [2022-12-22T00:49:35.108Z] Got response from /__/functions.yaml Failed to generate manifest from function source: SyntaxError: Unexpected token '.'
[2] [2022-12-22T00:49:35.108Z] Failed to parse functions.yamlincomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line at line 1, column 62:
[2] ... rom function source: SyntaxError: Unexpected token '.'
[2] ^ {"name":"YAMLException","reason":"incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line","mark":{"name":null,"buffer":"Failed to generate manifest from function source: SyntaxError: Unexpected token '.'\n\u0000","position":61,"line":0,"column":61},"message":"incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line at line 1, column 62:\n ... rom function source: SyntaxError: Unexpected token '.'\n ^"}
[2] [2022-12-22T00:49:35.114Z] shutdown requested via /__/quitquitquit
[2]
[2] ⬢ functions: Failed to load function definition from source: FirebaseError: Failed to load function definition from source: Failed to generate manifest from function source: SyntaxError: Unexpected token '.' {"metadata":{"emulator":{"name":"functions"},"message":"Failed to load function definition from source: FirebaseError: Failed to load function definition from source: Failed to generate manifest from function source: SyntaxError: Unexpected token '.'"}}
The prefixes are due to running firebase serve
with concurrently
(due to a tsc
+ tsc-alias
pairing). This worked before. Not sure what's changed but all of a sudden, I'm getting this error.
Alright I found a niche solution for my niche problem. I was using tsc-alias
to rename a @shared
repo which is just a folder that had been aliased in the monorepo.
My solution was to drill down into that folder when importing classes (there must have been some circular dependency somewhere). I.e., this involved changing import { User } from '@shared'
to import { User } from '@shared/models'
. I know this won't be of much help for people reading this in the future, but the first place to start would be ensuring nothing funky is going on with your imports.
Usually this error message indicates that Firebase CLI couldn't require("your-function-source")
.
In the OP's case, the real error message is this:
[debug] [2022-12-04T19:31:57.075Z] Got response from /__/functions.yaml Failed to generate manifest from function source: SyntaxError: Invalid left-hand side in assignment
SyntaxError: Invalid left-hand side in assignment
- means that there is an error in user code.
The best way to debug this issue is to try to execute your function source (e.g. node index.js
).
I think Firebase CLI should be outputting more helpful error message - I'll turn this issue as a feature request for that.
Hello, is there any update on this? We currently face the same problem which is firebase deploy --only functions
stopped working with the error
Failed to load function definition from source: Failed to generate manifest from function source: SyntaxError: Unexpected token 'export'
We're using TypeScript but compiling with tsc
does work as before. Also node lib/index.js
doesn't show any error. We're currently struggling to find which change actually broke deployment and which export
it doesn't like because we've been using export
all over the project before 🤷🏼♂️
Any updates? I have the same issue Node 18
[REQUIRED] Environment info
firebase-tools: 11.16.1
Platform: Ubuntu
[REQUIRED] Test case
package.json:
index.ts
[REQUIRED] Steps to reproduce
This error appears since the initialization.
[REQUIRED] Expected behaviour It should run without errors
[REQUIRED] Actual behavior
The error hinders the deployment of the firebase functions
firebase-debug.log:
I removed parts containing sensitive data