firebase-tools: v13.29.1
node: v22.11.0
- Installing dependencies
- Run
cd functions
- Run
npm i
- Run
cd ../
- Run
- Run
firebase deploy --only functions --project PROJECT_ID
- Functions is deployed, open "https://us-central1-PROJECT_ID.cloudfunctions.net/helloWorld"
function response
{
"custom_field": "This response is from a Firebase Cloud Function!",
"url": "https://api.github.com/repos/firebase/firebase-tools/issues/8100",
"status": 200,
"headers": {
"accept-ranges": "bytes",
"access-control-allow-origin": "*",
"access-control-expose-headers": "ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Used, X-RateLimit-Resource, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, X-GitHub-SSO, X-GitHub-Request-Id, Deprecation, Sunset",
"cache-control": "public, max-age=60, s-maxage=60",
"content-encoding": "gzip",
"content-length": "2664",
"content-security-policy": "default-src 'none'",
"content-type": "application/json; charset=utf-8",
"date": "Tue, 07 Jan 2025 12:54:16 GMT",
"etag": "W/\"3522502e629d6a190aea05a99d78901e720f9bad7c27a2376a642ff1a214576b\"",
"last-modified": "Mon, 06 Jan 2025 11:08:32 GMT",
"referrer-policy": "origin-when-cross-origin, strict-origin-when-cross-origin",
"server": "github.com",
"strict-transport-security": "max-age=31536000; includeSubdomains; preload",
"vary": "Accept,Accept-Encoding, Accept, X-Requested-With",
"x-content-type-options": "nosniff",
"x-frame-options": "deny",
"x-github-api-version-selected": "2022-11-28",
"x-github-media-type": "github.v3; format=json",
"x-github-request-id": "3E25:340964:23A9964:472666D:677D23F8",
"x-ratelimit-limit": "60",
"x-ratelimit-remaining": "59",
"x-ratelimit-reset": "1736258056",
"x-ratelimit-resource": "core",
"x-ratelimit-used": "1",
"x-xss-protection": "0"
},
"data": {
"url": "https://api.github.com/repos/firebase/firebase-tools/issues/8100",
"repository_url": "https://api.github.com/repos/firebase/firebase-tools",
"labels_url": "https://api.github.com/repos/firebase/firebase-tools/issues/8100/labels{/name}",
"comments_url": "https://api.github.com/repos/firebase/firebase-tools/issues/8100/comments",
"events_url": "https://api.github.com/repos/firebase/firebase-tools/issues/8100/events",
"html_url": "https://github.com/firebase/firebase-tools/issues/8100",
"id": 2770375654,
"node_id": "I_kwDOAOsFPM6lIJPm",
"number": 8100,
"title": "Deploy analysis error when importing octokit/rest",
"user": {
"login": "larssn",
"id": 890725,
"node_id": "MDQ6VXNlcjg5MDcyNQ==",
"avatar_url": "https://avatars.githubusercontent.com/u/890725?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/larssn",
"html_url": "https://github.com/larssn",
"followers_url": "https://api.github.com/users/larssn/followers",
"following_url": "https://api.github.com/users/larssn/following{/other_user}",
"gists_url": "https://api.github.com/users/larssn/gists{/gist_id}",
"starred_url": "https://api.github.com/users/larssn/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/larssn/subscriptions",
"organizations_url": "https://api.github.com/users/larssn/orgs",
"repos_url": "https://api.github.com/users/larssn/repos",
"events_url": "https://api.github.com/users/larssn/events{/privacy}",
"received_events_url": "https://api.github.com/users/larssn/received_events",
"type": "User",
"user_view_type": "public",
"site_admin": false
},
"labels": [
{
"id": 71928367,
"node_id": "MDU6TGFiZWw3MTkyODM2Nw==",
"url": "https://api.github.com/repos/firebase/firebase-tools/labels/type:%20bug",
"name": "type: bug",
"color": "fc2929",
"default": false,
"description": ""
},
{
"id": 1135777654,
"node_id": "MDU6TGFiZWwxMTM1Nzc3NjU0",
"url": "https://api.github.com/repos/firebase/firebase-tools/labels/api:%20functions",
"name": "api: functions",
"color": "acc9ef",
"default": false,
"description": ""
}
],
"state": "open",
"locked": false,
"assignee": null,
"assignees": [],
"milestone": null,
"comments": 0,
"created_at": "2025-01-06T10:43:49Z",
"updated_at": "2025-01-06T11:08:32Z",
"closed_at": null,
"author_association": "NONE",
"sub_issues_summary": {
"total": 0,
"completed": 0,
"percent_completed": 0
},
"active_lock_reason": null,
"body": "\u003C!-- DO NOT DELETE\nvalidate_template=true\ntemplate_path=.github/ISSUE_TEMPLATE/bug_report.md\n--\u003E\n\n\u003C!--\nThank you for contributing to the Firebase community!\n\nThink you found a bug?\n=======================\nYeah, we're definitely not perfect! Please use this template and include a minimal repro when opening the issue. If you know how to solve the issue, please create a Pull Request, and we'd be happy to review it!\n\nHave a feature request?\n========================\nGreat, we love hearing how we can improve our products! However, do not use this template to submit a feature request. Please submit your feature requests to: https://firebase.google.com/support/contact/bugs-features/\n\nHave a usage question?\n=======================\nWe get lots of those and we love helping you, but GitHub is not the best place for them and they will be closed. Please take a look at the guide first: https://firebase.google.com/docs/cli/\n\nIf the official documentation doesn't help, try asking through our official support channel: https://firebase.google.com/support/\n\nAdditional locations to check for solutions or assistance from the community:\n- Stack Overflow: https://stackoverflow.com/\n- Firebase Slack Community: https://firebase.community/\n\n*Please avoid duplicate posting across multiple channels!*\n--\u003E\n\n### [REQUIRED] Environment info\n\n\u003C!-- What version of the Firebase CLI (`firebase-tools`) are you using? Note that your issue may already be fixed in the latest versions. The latest version can be found at https://github.com/firebase/firebase-tools/releases --\u003E\n\n\u003C!-- Output of `firebase --version` --\u003E\n\n**firebase-tools: 13.29.1**\n\n\u003C!-- e.g. macOS, Windows, Ubuntu --\u003E\n\n**Platform: macOS**\n\n### [REQUIRED] Test case\n\n\u003C!-- Provide a minimal, complete, and verifiable example (http://stackoverflow.com/help/mcve) --\u003E\nAdd `import { Octokit } from '@octokit/rest'` to your index.ts\n\n### [REQUIRED] Steps to reproduce\n\n- Create a new project.\n- Install Octokit: `npm install @octokit/rest`\n- Import it in your index.ts file: `import { Octokit } from '@octokit/rest'`\n- deploy it: firebase deploy --only functions\n\nAn error will be thrown:\n```\nFirebaseAppError: The default Firebase app already exists. This means you called initializeApp() more than once without providing an app name as the second argument. In most cases you only need to call initializeApp() once. But if you do want to initialize multiple apps, pass a second argument to initializeApp() to give each app a unique name.\n at AppStore.initializeApp (/Users/lars/workspace/tillty/tillty_cloud_functions/functions/node_modules/firebase-admin/lib/app/lifecycle.js:41:23)\n at initializeApp (/Users/lars/workspace/tillty/tillty_cloud_functions/functions/node_modules/firebase-admin/lib/app/lifecycle.js:102:36)\n at Object.\u003Canonymous\u003E (/Users/lars/workspace/tillty/tillty_cloud_functions/functions/src/index.ts:7:14)\n at Module._compile (node:internal/modules/cjs/loader:1358:14)\n at Object.Module._extensions..js (node:internal/modules/cjs/loader:1416:10)\n at Module.load (node:internal/modules/cjs/loader:1208:32)\n at Function.Module._load (node:internal/modules/cjs/loader:1024:12)\n at cjsLoader (node:internal/modules/esm/translators:348:17)\n at ModuleWrap.\u003Canonymous\u003E (node:internal/modules/esm/translators:297:7)\n at ModuleJob.run (node:internal/modules/esm/module_job:222:25) {\n errorInfo: {\n code: 'app/duplicate-app',\n message: 'The default Firebase app already exists. This means you called initializeApp() more than once without providing an app name as the second argument. In most cases you only need to call initializeApp() once. But if you do want to initialize multiple apps, pass a second argument to initializeApp() to give each app a unique name.'\n },\n codePrefix: 'app'\n}\n\n\nError: Functions codebase could not be analyzed successfully. It may have a syntax or runtime error\n```\n\nNow remove the import and try again.\n\nIt should deploy successfully.\n\n### [REQUIRED] Expected behavior\n\nI expect Octokit to be usable.\n\n### [REQUIRED] Actual behavior\n\nI think this is a false positive of the code analysis algorithm that runs before deployment.",
"closed_by": null,
"reactions": {
"url": "https://api.github.com/repos/firebase/firebase-tools/issues/8100/reactions",
"total_count": 0,
"+1": 0,
"-1": 0,
"laugh": 0,
"hooray": 0,
"confused": 0,
"heart": 0,
"rocket": 0,
"eyes": 0
},
"timeline_url": "https://api.github.com/repos/firebase/firebase-tools/issues/8100/timeline",
"performed_via_github_app": null,
"state_reason": null
}
}