firebase / firebase-tools

The Firebase Command Line Tools
MIT License
4.01k stars 929 forks source link

The command line is too long. #7250

Closed jongcodes closed 1 month ago

jongcodes commented 3 months ago

[REQUIRED] Environment info

firebase-tools : 13.11.2

Platform : Windows

Next.js : 14.2.4

[REQUIRED] Test case

N/A

[REQUIRED] Steps to reproduce

  1. Run firebase deploy command

[REQUIRED] Expected behavior

N/A

[REQUIRED] Actual behavior

I'm using Next.js with hosting integration. I'm getting the following error when deploying:

...

Building a Cloud Function to run this application. This is needed due to:
 • middleware
 • non-static component /[locale]/[...rest]/page
 • non-static component /[locale]/page

Unable to bundle next.config.mjs for use in Cloud Functions, proceeding with deploy but problems may be encountered.
The command line is too long.

...

However, a final message indicating that deployment has been completed successfully is displayed.

jongcodes commented 3 months ago

My next.config.mjs file code is:

import createNextIntlPlugin from "next-intl/plugin";

const withNextIntl = createNextIntlPlugin();

/** @type {import("next").NextConfig} */
const nextConfig = {};

export default withNextIntl(nextConfig);

Related issues

  1. https://stackoverflow.com/questions/77783368/unable-to-bundle-next-config-js-for-use-in-cloud-functions-firebase-next-js
leoortizz commented 3 months ago

Hey @busanTeddyBear, can you please share your package.json?

jongcodes commented 3 months ago

@leoortizz

Yes, of course.

This is the /hosting/package.json file content:

{
    "name": "hosting",
    "version": "0.1.0",
    "private": true,
    "scripts": {
        "dev": "next dev",
        "build": "next build",
        "start": "next start",
        "lint": "next lint"
    },
    "dependencies": {
        "@heroicons/react": "^2.1.3",
        "@nextui-org/react": "^2.4.1",
        "framer-motion": "^11.2.10",
        "next": "^14.2.3",
        "next-intl": "^3.15.0",
        "next-themes": "^0.3.0",
        "react": "^18.3.1",
        "react-device-detect": "^2.2.3",
        "react-dom": "^18.3.1",
        "zustand": "^4.5.2"
    },
    "devDependencies": {
        "@types/node": "^20.14.2",
        "@types/react": "^18.3.3",
        "@types/react-dom": "^18.3.0",
        "autoprefixer": "^10.4.19",
        "eslint": "^8.57.0",
        "eslint-config-next": "^14.2.3",
        "eslint-plugin-perfectionist": "^2.10.0",
        "postcss": "^8.4.38",
        "prettier": "^3.3.2",
        "prettier-plugin-tailwindcss": "^0.6.2",
        "tailwindcss": "^3.4.4",
        "typescript": "^5.4.5"
    }
}

This is the /functions/package.json file content:

{
    "name": "functions",
    "description": "Cloud Functions for Firebase",
    "scripts": {
        "serve": "firebase emulators:start --only functions",
        "shell": "firebase functions:shell",
        "start": "npm run shell",
        "deploy": "firebase deploy --only functions",
        "logs": "firebase functions:log"
    },
    "engines": {
        "node": "20"
    },
    "main": "index.js",
    "dependencies": {
        "firebase-admin": "^12.1.1",
        "firebase-functions": "^5.0.1"
    },
    "devDependencies": {
        "firebase-functions-test": "^3.3.0"
    },
    "private": true
}

This is the /firebase.json file content:

{
    "firestore": {
        "rules": "firestore.rules",
        "indexes": "firestore.indexes.json"
    },

    "functions": [
        {
            "source": "functions",
            "codebase": "default",

            "ignore": [
                "node_modules",
                ".git",
                "firebase-debug.log",
                "firebase-debug.*.log"
            ]
        }
    ],

    "hosting": {
        "source": "hosting",
        "ignore": ["firebase.json", "**/.*", "**/node_modules/**"],

        "rewrites": [
            {
                "source": "/apis/getChatCompletions",

                "function": {
                    "functionId": "getChatCompletions"
                }
            }
        ],

        "frameworksBackend": {
            "region": "asia-northeast3"
        }
    },

    "storage": {
        "rules": "storage.rules"
    },

    "emulators": {
        "functions": {
            "port": 5001
        },

        "firestore": {
            "port": 8080
        },

        "hosting": {
            "port": 5000
        },

        "storage": {
            "port": 9199
        },

        "ui": {
            "enabled": true
        },

        "singleProjectMode": true
    }
}
jongcodes commented 1 month ago

I will close this issue since the error mentioned here no longer occurs starting from firebase-tools: 13.15.1.

However, another problem has arisen from this, so I have created a new issue.

https://github.com/firebase/firebase-tools/issues/7549