Skip to content

Deployment fails with ERR_PACKAGE_PATH_NOT_EXPORTED for v2/auth on Windows #8837

Description

@jhonjazzbass

[REQUIRED] Environment info

firebase-tools:
14.9.0

Platform:
Windows

[REQUIRED] Test case

My functions/package.json file:

JSON

{
"name": "functions",
"description": "Cloud Functions for Firebase",
"main": "index.js",
"dependencies": {
"firebase-admin": "^12.6.0",
"firebase-functions": "^6.0.1"
},
"engines": {
"node": "20"
},
"private": true
}

My functions/index.js file:

JavaScript

const admin = require("firebase-admin");

// This is the documented import method for this SDK version
const { onUserCreated } = require("firebase-functions/v2/auth");

admin.initializeApp();

exports.setupNewUser = onUserCreated((user) => {
console.log(New user created: ${user.uid});
return;
});

[REQUIRED] Steps to reproduce

On a Windows machine with Node.js v20 (LTS) installed, create a new empty folder.

Run firebase init functions.

Link it to an existing Firebase project.

When prompted, choose JavaScript as the language.

Replace the contents of functions/package.json and functions/index.js with the code provided in the "Test case" section above.

Navigate into the functions directory (cd functions).

Run npm install.

Run firebase deploy --only functions

[REQUIRED] Expected behavior

The deployment command should complete successfully without errors.

[REQUIRED] Actual behavior

The deployment fails during the code analysis phase with the error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './v2/auth' is not defined by "exports". This occurs even in a completely clean project directory with the latest dependencies and the LTS version of Node.js.

PS C:\Users\jhona\Desktop\proyecto-final\functions> firebase deploy --only functions --debug
[2025-07-12T00:00:43.605Z] > command requires scopes: ["email","openid","https://www.googleapis.com/auth/cloudplatformprojects.readonly","https://www.googleapis.com/auth/firebase","https://www.googleapis.com/auth/cloud-platform"]
[2025-07-12T00:00:43.609Z] > authorizing via signed-in user (jhonatanhnmz@gmail.com)
[2025-07-12T00:00:43.609Z] [iam] checking project smart-food-ai for permissions ["cloudfunctions.functions.create","cloudfunctions.functions.delete","cloudfunctions.functions.get","cloudfunctions.functions.list","cloudfunctions.functions.update","cloudfunctions.operations.get","firebase.projects.get"]
[2025-07-12T00:00:43.614Z] Checked if tokens are valid: true, expires at: 1752281309201
[2025-07-12T00:00:43.615Z] Checked if tokens are valid: true, expires at: 1752281309201
[2025-07-12T00:00:43.619Z] >>> [apiv2][query] POST https://cloudresourcemanager.googleapis.com/v1/projects/smart-food-ai:testIamPermissions [none]
[2025-07-12T00:00:43.619Z] >>> [apiv2][(partial)header] POST https://cloudresourcemanager.googleapis.com/v1/projects/smart-food-ai:testIamPermissions x-goog-quota-user=projects/smart-food-ai
[2025-07-12T00:00:43.620Z] >>> [apiv2][body] POST https://cloudresourcemanager.googleapis.com/v1/projects/smart-food-ai:testIamPermissions {"permissions":["cloudfunctions.functions.create","cloudfunctions.functions.delete","cloudfunctions.functions.get","cloudfunctions.functions.list","cloudfunctions.functions.update","cloudfunctions.operations.get","firebase.projects.get"]}
[2025-07-12T00:00:44.799Z] <<< [apiv2][status] POST https://cloudresourcemanager.googleapis.com/v1/projects/smart-food-ai:testIamPermissions 200
[2025-07-12T00:00:44.800Z] <<< [apiv2][body] POST https://cloudresourcemanager.googleapis.com/v1/projects/smart-food-ai:testIamPermissions {"permissions":["cloudfunctions.functions.create","cloudfunctions.functions.delete","cloudfunctions.functions.get","cloudfunctions.functions.list","cloudfunctions.functions.update","cloudfunctions.operations.get","firebase.projects.get"]}
[2025-07-12T00:00:44.800Z] Checked if tokens are valid: true, expires at: 1752281309201
[2025-07-12T00:00:44.801Z] Checked if tokens are valid: true, expires at: 1752281309201
[2025-07-12T00:00:44.801Z] >>> [apiv2][query] POST https://iam.googleapis.com/v1/projects/smart-food-ai/serviceAccounts/smart-food-ai@appspot.gserviceaccount.com:testIamPermissions [none]
[2025-07-12T00:00:44.801Z] >>> [apiv2][body] POST https://iam.googleapis.com/v1/projects/smart-food-ai/serviceAccounts/smart-food-ai@appspot.gserviceaccount.com:testIamPermissions {"permissions":["iam.serviceAccounts.actAs"]}
[2025-07-12T00:00:46.034Z] <<< [apiv2][status] POST https://iam.googleapis.com/v1/projects/smart-food-ai/serviceAccounts/smart-food-ai@appspot.gserviceaccount.com:testIamPermissions 200
[2025-07-12T00:00:46.035Z] <<< [apiv2][body] POST https://iam.googleapis.com/v1/projects/smart-food-ai/serviceAccounts/smart-food-ai@appspot.gserviceaccount.com:testIamPermissions {"permissions":["iam.serviceAccounts.actAs"]}

=== Deploying to 'smart-food-ai'...

i deploying functions
[2025-07-12T00:00:46.041Z] Checked if tokens are valid: true, expires at: 1752281309201
[2025-07-12T00:00:46.041Z] Checked if tokens are valid: true, expires at: 1752281309201
[2025-07-12T00:00:46.041Z] >>> [apiv2][query] GET https://cloudresourcemanager.googleapis.com/v1/projects/smart-food-ai [none]
[2025-07-12T00:00:46.303Z] <<< [apiv2][status] GET https://cloudresourcemanager.googleapis.com/v1/projects/smart-food-ai 200
[2025-07-12T00:00:46.304Z] <<< [apiv2][body] GET https://cloudresourcemanager.googleapis.com/v1/projects/smart-food-ai {"projectNumber":"636331493711","projectId":"smart-food-ai","lifecycleState":"ACTIVE","name":"smart-food-ai","labels":{"firebase":"enabled","firebase-core":"disabled"},"createTime":"2025-07-07T19:46:42.647129Z"}
i functions: preparing codebase default for deployment
i functions: ensuring required API cloudfunctions.googleapis.com is enabled...
i functions: ensuring required API cloudbuild.googleapis.com is enabled...
i artifactregistry: ensuring required API artifactregistry.googleapis.com is enabled...
[2025-07-12T00:00:46.308Z] Checked if tokens are valid: true, expires at: 1752281309201
[2025-07-12T00:00:46.309Z] Checked if tokens are valid: true, expires at: 1752281309201
[2025-07-12T00:00:46.309Z] >>> [apiv2][query] GET https://firebase.googleapis.com/v1beta1/projects/smart-food-ai/adminSdkConfig [none]
[2025-07-12T00:00:46.757Z] <<< [apiv2][status] GET https://firebase.googleapis.com/v1beta1/projects/smart-food-ai/adminSdkConfig 200
[2025-07-12T00:00:46.758Z] <<< [apiv2][body] GET https://firebase.googleapis.com/v1beta1/projects/smart-food-ai/adminSdkConfig {"projectId":"smart-food-ai","storageBucket":"smart-food-ai.firebasestorage.app"}
[2025-07-12T00:00:46.759Z] Checked if tokens are valid: true, expires at: 1752281309201
[2025-07-12T00:00:46.760Z] Checked if tokens are valid: true, expires at: 1752281309201
[2025-07-12T00:00:46.760Z] >>> [apiv2][query] GET https://runtimeconfig.googleapis.com/v1beta1/projects/smart-food-ai/configs [none]
[2025-07-12T00:00:47.367Z] <<< [apiv2][status] GET https://runtimeconfig.googleapis.com/v1beta1/projects/smart-food-ai/configs 200
[2025-07-12T00:00:47.368Z] <<< [apiv2][body] GET https://runtimeconfig.googleapis.com/v1beta1/projects/smart-food-ai/configs {"configs":[{"name":"projects/smart-food-ai/configs/openai"}]}
[2025-07-12T00:00:47.370Z] Checked if tokens are valid: true, expires at: 1752281309201
[2025-07-12T00:00:47.371Z] Checked if tokens are valid: true, expires at: 1752281309201
[2025-07-12T00:00:47.372Z] >>> [apiv2][query] GET https://runtimeconfig.googleapis.com/v1beta1/projects/smart-food-ai/configs/openai/variables [none]
[2025-07-12T00:00:48.266Z] <<< [apiv2][status] GET https://runtimeconfig.googleapis.com/v1beta1/projects/smart-food-ai/configs/openai/variables 200
[2025-07-12T00:00:48.267Z] <<< [apiv2][body] GET https://runtimeconfig.googleapis.com/v1beta1/projects/smart-food-ai/configs/openai/variables {"variables":[{"name":"projects/smart-food-ai/configs/openai/variables/key","updateTime":"2025-07-08T22:21:16.021970267Z"}]}
[2025-07-12T00:00:48.268Z] Checked if tokens are valid: true, expires at: 1752281309201
[2025-07-12T00:00:48.268Z] Checked if tokens are valid: true, expires at: 1752281309201
[2025-07-12T00:00:48.269Z] >>> [apiv2][query] GET https://runtimeconfig.googleapis.com/v1beta1/projects/smart-food-ai/configs/openai/variables/key [none]
[2025-07-12T00:00:48.634Z] <<< [apiv2][status] GET https://runtimeconfig.googleapis.com/v1beta1/projects/smart-food-ai/configs/openai/variables/key 200
[2025-07-12T00:00:48.635Z] <<< [apiv2][body] GET https://runtimeconfig.googleapis.com/v1beta1/projects/smart-food-ai/configs/openai/variables/key {"name":"projects/smart-food-ai/configs/openai/variables/key","updateTime":"2025-07-08T22:21:16.021970267Z","text":""}
[2025-07-12T00:00:48.638Z] Validating nodejs source
[2025-07-12T00:00:50.595Z] > [functions] package.json contents: {
"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.6.0",
"firebase-functions": "^6.0.1"
},
"private": true
}
[2025-07-12T00:00:50.597Z] Building nodejs source
i functions: Loading and analyzing source code for codebase default to determine what to deploy
[2025-07-12T00:00:50.599Z] Could not find functions.yaml. Must use http discovery
[2025-07-12T00:00:50.625Z] Found firebase-functions binary at 'C:\Users\jhona\Desktop\proyecto-final\functions\node_modules.bin\firebase-functions'
Serving at port 8717

Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './v2/auth' is not defined by "exports" in C:\Users\jhona\Desktop\proyecto-final\functions\node_modules\firebase-functions\package.json
at exportsNotFound (node:internal/modules/esm/resolve:322:10)
at packageExportsResolve (node:internal/modules/esm/resolve:670:9)
at resolveExports (node:internal/modules/cjs/loader:636:36)
at Module._findPath (node:internal/modules/cjs/loader:716:31)
at Module._resolveFilename (node:internal/modules/cjs/loader:1198:27)
at Module._load (node:internal/modules/cjs/loader:1043:27)
at Module.require (node:internal/modules/cjs/loader:1298:19)
at require (node:internal/modules/helpers:182:18)
at Object. (C:\Users\jhona\Desktop\proyecto-final\functions\index.js:4:27)
at Module._compile (node:internal/modules/cjs/loader:1529:14) {
code: 'ERR_PACKAGE_PATH_NOT_EXPORTED'
}

[2025-07-12T00:00:51.270Z] Got response code 400; body Failed to generate manifest from function source: Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './v2/auth' is not defined by "exports" in C:\Users\jhona\Desktop\proyecto-final\functions\node_modules\firebase-functions\package.json

Error: Functions codebase could not be analyzed successfully. It may have a syntax or runtime error

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions