{"id":19589778,"url":"https://github.com/supercharge/hapi-google-cloud-functions","last_synced_at":"2026-03-08T22:33:25.469Z","repository":{"id":57163608,"uuid":"227383324","full_name":"supercharge/hapi-google-cloud-functions","owner":"supercharge","description":"Serverless functions on Google Cloud Functions with hapi.js","archived":false,"fork":false,"pushed_at":"2021-07-09T07:58:17.000Z","size":52,"stargazers_count":3,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-10-16T06:40:18.998Z","etag":null,"topics":["google-cloud","hapi","hapijs","nodejs","serverless","serverless-functions","supercharge"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/supercharge.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-12-11T14:20:36.000Z","updated_at":"2021-09-16T10:45:49.000Z","dependencies_parsed_at":"2022-09-01T03:11:53.228Z","dependency_job_id":null,"html_url":"https://github.com/supercharge/hapi-google-cloud-functions","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/supercharge/hapi-google-cloud-functions","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/supercharge%2Fhapi-google-cloud-functions","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/supercharge%2Fhapi-google-cloud-functions/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/supercharge%2Fhapi-google-cloud-functions/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/supercharge%2Fhapi-google-cloud-functions/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/supercharge","download_url":"https://codeload.github.com/supercharge/hapi-google-cloud-functions/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/supercharge%2Fhapi-google-cloud-functions/sbom","scorecard":{"id":859349,"data":{"date":"2025-08-11","repo":{"name":"github.com/supercharge/hapi-google-cloud-functions","commit":"47a2014bd40634c4c2c5226f8218bd0b8da024f4"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3.4,"checks":[{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Code-Review","score":0,"reason":"Found 1/27 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/publish-in-github-registry.yml:12: update your workflow using https://app.stepsecurity.io/secureworkflow/supercharge/hapi-google-cloud-functions/publish-in-github-registry.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/publish-in-github-registry.yml:13: update your workflow using https://app.stepsecurity.io/secureworkflow/supercharge/hapi-google-cloud-functions/publish-in-github-registry.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/publish-in-github-registry.yml:24: update your workflow using https://app.stepsecurity.io/secureworkflow/supercharge/hapi-google-cloud-functions/publish-in-github-registry.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/publish-in-github-registry.yml:27: update your workflow using https://app.stepsecurity.io/secureworkflow/supercharge/hapi-google-cloud-functions/publish-in-github-registry.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/run-tests.yml:16: update your workflow using https://app.stepsecurity.io/secureworkflow/supercharge/hapi-google-cloud-functions/run-tests.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/run-tests.yml:19: update your workflow using https://app.stepsecurity.io/secureworkflow/supercharge/hapi-google-cloud-functions/run-tests.yml/master?enable=pin","Warn: npmCommand not pinned by hash: .github/workflows/publish-in-github-registry.yml:17","Warn: npmCommand not pinned by hash: .github/workflows/publish-in-github-registry.yml:35","Warn: npmCommand not pinned by hash: .github/workflows/run-tests.yml:25","Info:   0 out of   6 GitHub-owned GitHubAction dependencies pinned","Info:   0 out of   3 npmCommand dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/publish-in-github-registry.yml:1","Warn: no topLevel permission defined: .github/workflows/run-tests.yml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 6 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-24T00:47:51.922Z","repository_id":57163608,"created_at":"2025-08-24T00:47:51.922Z","updated_at":"2025-08-24T00:47:51.922Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30275569,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-08T20:45:49.896Z","status":"ssl_error","status_checked_at":"2026-03-08T20:45:49.525Z","response_time":56,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["google-cloud","hapi","hapijs","nodejs","serverless","serverless-functions","supercharge"],"created_at":"2024-11-11T08:20:57.410Z","updated_at":"2026-03-08T22:33:25.448Z","avatar_url":"https://github.com/supercharge.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\r\n  \u003ca href=\"https://superchargejs.com\"\u003e\r\n    \u003cimg width=\"471\" style=\"max-width:100%;\" src=\"https://superchargejs.com/images/supercharge-text.svg\" /\u003e\r\n  \u003c/a\u003e\r\n  \u003cbr/\u003e\r\n  \u003cbr/\u003e\r\n  \u003cp\u003e\r\n    \u003ch3\u003ehapi in Google Cloud Functions\u003c/h3\u003e\r\n  \u003c/p\u003e\r\n  \u003cp\u003e\r\n    Run your hapi server in a Google Cloud function.\r\n  \u003c/p\u003e\r\n  \u003cbr/\u003e\r\n  \u003cp\u003e\r\n    \u003ca href=\"#installation\"\u003e\u003cstrong\u003eInstallation\u003c/strong\u003e\u003c/a\u003e ·\r\n    \u003ca href=\"#usage\"\u003e\u003cstrong\u003eUsage\u003c/strong\u003e\u003c/a\u003e\r\n  \u003c/p\u003e\r\n  \u003cbr/\u003e\r\n  \u003cbr/\u003e\r\n  \u003cp\u003e\r\n    \u003ca href=\"https://www.npmjs.com/package/@supercharge/hapi-google-cloud-functions\"\u003e\u003cimg src=\"https://img.shields.io/npm/v/@supercharge/hapi-google-cloud-functions.svg\" alt=\"Latest Version\"\u003e\u003c/a\u003e\r\n    \u003ca href=\"https://www.npmjs.com/package/@supercharge/hapi-google-cloud-functions\"\u003e\u003cimg src=\"https://img.shields.io/npm/dm/@supercharge/hapi-google-cloud-functions.svg\" alt=\"Monthly downloads\"\u003e\u003c/a\u003e\r\n  \u003c/p\u003e\r\n  \u003cp\u003e\r\n    \u003cem\u003eFollow \u003ca href=\"http://twitter.com/marcuspoehls\"\u003e@marcuspoehls\u003c/a\u003e and \u003ca href=\"http://twitter.com/superchargejs\"\u003e@superchargejs\u003c/a\u003e for updates!\u003c/em\u003e\r\n  \u003c/p\u003e\r\n\u003c/div\u003e\r\n\r\n---\r\n\r\n## Introduction\r\nServerless is becoming popular and widely accepted in the developer community. Going serverless requires a mindset shift. Going serverless requires you to think stateless.\r\n\r\nThis `@supercharge/hapi-google-cloud-functions` package let’s you use your [hapi.js](https://hapi.dev) HTTP server in a Google Cloud function.\r\n\r\nThis package wraps your hapi server and transforms an incoming request to the cloud function into a hapi-compatible request. This request will be injected into your hapi server and the resulting response transformed *back* into a cloud-function-compatible format.\r\n\r\nIt’s basically a “done for you” package to run your hapi server in a serverless function on Google Cloud.\r\n\r\n\r\n## Requirements\r\n\u003e **hapi v19 (or later)** and **Node.js v12 (or newer)**\r\n\r\nThis plugin requires **hapi v19** (or later) and **Node.js v12 or newer**.\r\n\r\n\r\n### Compatibility\r\n| Major Release | [hapi.js](https://github.com/hapijs/hapi) version | Node.js version |\r\n| --- | --- | --- |\r\n| `v2` | `\u003e=19 @hapi/hapi` | `\u003e=12` |\r\n| `v1` | `\u003e=18 hapi` | `\u003e=8` |\r\n\r\n\r\n## Installation\r\n\r\n```\r\nnpm i @supercharge/hapi-google-cloud-functions\r\n```\r\n\r\n\r\n## Usage\r\nUsing `@supercharge/hapi-google-cloud-functions` is pretty straightforward:\r\n\r\n```js\r\n'use strict'\r\n\r\nconst Hapi = require('@hapi/hapi')\r\nconst CloudFunctionHandler = require('@supercharge/hapi-google-cloud-functions')\r\n\r\n// this `handler` will be used as a cached instance\r\n// a warm function will reuse the handler for incoming requests\r\nlet handler\r\n\r\nmodule.exports.http = async (request, response) =\u003e {\r\n  if (!handler) {\r\n     // First, compose your hapi server with all the plugins and dependencies\r\n    server = new Hapi.Server()\r\n\r\n    await server.register({\r\n      plugin: require('@hapi/vision')\r\n    })\r\n\r\n    // Second, create a handler instance for your server which will\r\n    // transform the Cloud function request into a hapi-compatible\r\n    // request. Then, send the request through your hapi server\r\n    // and transform the response from hapi into a\r\n    // function-compatible response\r\n    handler = CloudFunctionHandler.for(server)\r\n  }\r\n\r\n  return handler.proxy(request, response)\r\n}\r\n```\r\n\r\n\r\n## Deployment Example\r\nThere’s a deployment example in the [supercharge/playground-google-cloud-functions](https://github.com/supercharge/playground-google-cloud-functions) repository.\r\n\r\nWe used the [Serverless](https://serverless.com/cli/) framework to deploy a Supercharge app in the `playground-google-cloud-functions` repository. The Serverless CLI is sweet because it allows you to deploy your app from a single configuration file.\r\n\r\n\r\n### 1. Install the `serverless-google-cloudfunctions` Package\r\nWhen deploying with the Serverless CLI, you need to add the [`serverless-google-cloudfunctions`](https://github.com/serverless/serverless-google-cloudfunctions) package as a dependency to your project. Install it from NPM:\r\n\r\n```bash\r\nnpm i serverless-google-cloudfunctions\r\n```\r\n\r\nThen, you must add it as a plugin to your `serverless.yml` file. The next step describes this file in more detail.\r\n\r\n\r\n### 2. Deploy to a Google Cloud Function\r\nDeploying to Google Cloud from the Serverless CLI needs a keyfile. Follow these steps in the Serverless docs to [set up your Google Cloud credentials and generate a keyfile](https://serverless.com/framework/docs/providers/google/guide/credentials#get-credentials--assign-roles).\r\n\r\nHere’s the sample `serverless.yml` used to deploy the app:\r\n\r\n```yaml\r\nservice: supercharge-gcp-function # do not use the \"google\" in the name\r\n\r\nprovider:\r\n  name: google\r\n  runtime: nodejs8\r\n  region: europe-west1\r\n  project: your-gcp-project-name\r\n  credentials: ./path/to/your/gcp-keyfile.json\r\n\r\nfunctions:\r\n  app:\r\n    handler: http\r\n    memorySize: 256 # default is 1024 MB\r\n    events:\r\n      - http: path\r\n\r\nplugins:\r\n  - serverless-google-cloudfunctions\r\n```\r\n\r\n\r\n### 3. Deploy\r\nDeploy your project to Google Cloud using the Serverless CLI. Run the following command from your project directory:\r\n\r\n```bash\r\nsls deploy\r\n```\r\n\r\nThe deployment process may take some minutes. When finished, you’ll see a URL to access the deployed function. Enjoy!\r\n\r\n\r\n## Contributing\r\nDo you miss a string function? We very much appreciate your contribution! Please send in a pull request 😊\r\n\r\n1.  Create a fork\r\n2.  Create your feature branch: `git checkout -b my-feature`\r\n3.  Commit your changes: `git commit -am 'Add some feature'`\r\n4.  Push to the branch: `git push origin my-new-feature`\r\n5.  Submit a pull request 🚀\r\n\r\n\r\n## License\r\nMIT © [Supercharge](https://superchargejs.com)\r\n\r\n---\r\n\r\n\u003e [superchargejs.com](https://superchargejs.com) \u0026nbsp;\u0026middot;\u0026nbsp;\r\n\u003e GitHub [@supercharge](https://github.com/supercharge) \u0026nbsp;\u0026middot;\u0026nbsp;\r\n\u003e Twitter [@superchargejs](https://twitter.com/superchargejs)\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsupercharge%2Fhapi-google-cloud-functions","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsupercharge%2Fhapi-google-cloud-functions","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsupercharge%2Fhapi-google-cloud-functions/lists"}