{"id":21534726,"url":"https://github.com/seanmtracey/openwhisk-dependency-compiler","last_synced_at":"2026-05-21T10:02:12.086Z","repository":{"id":146345885,"uuid":"216460808","full_name":"seanmtracey/openwhisk-dependency-compiler","owner":"seanmtracey","description":"A small function for compiling Node.js dependencies in the cloud for easier deployment of native modules","archived":false,"fork":false,"pushed_at":"2019-10-28T12:22:17.000Z","size":2739,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-17T20:15:17.920Z","etag":null,"topics":["ibm","ibmcloud","nodejs","openwhisk","serverless"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/seanmtracey.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-10-21T02:25:36.000Z","updated_at":"2020-02-11T18:32:40.000Z","dependencies_parsed_at":"2023-05-30T18:30:33.658Z","dependency_job_id":null,"html_url":"https://github.com/seanmtracey/openwhisk-dependency-compiler","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/seanmtracey/openwhisk-dependency-compiler","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/seanmtracey%2Fopenwhisk-dependency-compiler","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/seanmtracey%2Fopenwhisk-dependency-compiler/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/seanmtracey%2Fopenwhisk-dependency-compiler/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/seanmtracey%2Fopenwhisk-dependency-compiler/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/seanmtracey","download_url":"https://codeload.github.com/seanmtracey/openwhisk-dependency-compiler/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/seanmtracey%2Fopenwhisk-dependency-compiler/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33297114,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-21T02:57:32.698Z","status":"ssl_error","status_checked_at":"2026-05-21T02:57:31.990Z","response_time":62,"last_error":"SSL_read: 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":["ibm","ibmcloud","nodejs","openwhisk","serverless"],"created_at":"2024-11-24T03:12:32.077Z","updated_at":"2026-05-21T10:02:12.051Z","avatar_url":"https://github.com/seanmtracey.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# OpenWhisk Dependency Compiler\nA serverless function for compiling Node.js dependencies for serverless functions.\n\n## What's this all about?\n\n![I used the serverless to create the serverless](resources/create_the_serverless.jpg \"Thanos did nothing wrong\")\n\n### The Problem\n\nServerless functions are great, but for some functions, shipping dependencies + packages that make your life easier is a little tricky. \n\nIf all of your dependencies are written in pure JS, you're pretty set to go, you just need to install them, zip them up, and send them on their way. \n\nBut, if one or more of your dependencies have a native component, you're in trouble. If you're lucky enough to be running the same operating system as the environment you're planning to deploy your serverless function to, you're good to go, but this is often not the case - and installing Docker images to compile dependencies is a nightmare too.\n\n### A Solution\n\nWith this function, you can send up your `package.json` file for your serverless project where they'll be installed, zipped up, and returned to you for deployment.\n\nThis way, you'll be compiling your dependencies in the exact same environment you'll be shipping your function to.\n\n## It can't be that simple...\n\nOh! but it can be, dear reader! Once you've set up this function, you can compile your Node.js modules with a single cURL command a bit like this:\n\n```\ncurl -X POST -H \"Content-Type: application/json\" -d @package.json https://\u003cHOST_FOR_YOUR_OPENWHISK_FUNCTIONS\u003e/api/v1/web/\u003cYOUR FUNCTION PATH\u003e?secret=\u003cYOUR FUNCTION SECRET\u003e -o deps.tar.gz\n```\n\nThis will send up your `package.json` file to compiler function, which will install the dependencies, whack them in a tar file, and send them back to your computer.\n\nThen you're good to go.\n\n## OK, how do I use this then?\n\nI'm glad you asked. By following the instructions below, you'll be able to create, host and invoke the `openwhisk-dependency-compiler` function on the IBM Cloud - then you'll never have to worry about deployment target compatability ever again.\n\n## Setting up with the IBM Cloud UI\n\nIf you don't have an IBM Cloud account, you can [create one here](https://cloud.ibm.com/registration)\n\nOnce you've done that, log in, and you'll be presented with the dashboard.\n\n![An image of the IBM Cloud dashboard](resources/ibm_cloud_dashboard.png \"IBM Cloud Dashboard\")\n\nOnce there, click the hamburger menu (highlighted in red) and then click the \"Functions\" option (highlighted in green)\n\n![An image showing how to access the IBM Cloud Functions from the dashboard](resources/ibm_cloud_dashboard_functions.png \"IBM Cloud Functons\")\n\nThis will take you to the IBM Cloud Functions dashboard (IBM Cloud Functions are powered by OpenWhisk) We're going to create an action, so click on the \"Actions\" button (highlighted in purple)\n\n![An image showing how to access the actions panel of the IBM Cloud Functions dashboard](resources/ibm_cloud_functions_actions.png \"Accessing the actions\")\n\nIf you've made serverless functions before, you'll see a list much like the one in the image below, if not, don't worry, this'll be your first!\n\nClick the \"Create button\" (highlighted in red)\n\n![An image showing how to access the actions panel of the IBM Cloud Functions dashboard](resources/create_function_button.png \"Creating the function\")\n\nYou'll be given a series of options on how you'd like to create your function. Click \"Create Action\" (highlighted in green)\n\n![An image showing how to access the actions panel of the IBM Cloud Functions dashboard](resources/create_action.png \"Creating the function\")\n\nThis will take you through to the \"Create Action\" UI. Give your function any name you like, I'm going to call mine \"deps_compiler\".\n\nMake sure the runtime that's selected matches the runtime that you intend to deploy your dependencies to, otherwise this may not work.\n\nOnce you've entered a valid name, click the create button (highlighted in red)\n\n![An image showing how to access the actions panel of the IBM Cloud Functions dashboard](resources/create_action_with_settings.png \"Creating the function\")\n\nIf all goes well, our function is now created! 🎉\n\nYou should see a window for inputting code, and you'll notice that it doesn't do very much yet, but that's about to change.\n\n![An image showing how to access the actions panel of the IBM Cloud Functions dashboard](resources/hello_world.png \"The Hello, world serverless function\")\n\nOpen up the [main.js](main.js) file in this repo, and copy all of the code in there, delete the default code in the textarea, then paste the contents of main.js in its place. \n\nThen hit save (highlighted in green)\n\n![An image showing how to access the actions panel of the IBM Cloud Functions dashboard](resources/save_main_js.png \"Save the code for our new function\")\n\nWe now have a serverless function that we can use to compile our Node.js dependencies, but we're not quite done yet. We need to configure out function to recieve a HTTP request with our `package.json` full of dependencies to compile.\n\nFortunately, this isn't too difficult.\n\nClick the \"Endpoints\" button (highlighted in purple)\n\n![An image showing how to access the actions panel of the IBM Cloud Functions dashboard](resources/endpoints.png \"Click the Endpoints button\")\n\nOnce in the endpoints view, click the checkboxes for \"Enable as a Web Action\" and \"Raw HTTP Handling\" (highlighted in green) and then click the \"Save\" button (highlighted in red)\n\n![An image showing how to access the actions panel of the IBM Cloud Functions dashboard](resources/enable_web_actions.png \"Enable web actions + Raw HTTP handling\")\n\nThis will create a URL that we can make a `POST` request to with our `package.json` file which will return our compiled dependencies!\n\nRight now, this endpoint is public, so anybody could trigger it, which isn't great if you want to keep your costs low, so we're going to set a parameter with a key that will only let us activate the function.\n\nClick on the \"Parameters\" button (highlighted in green)\n\n![An image showing how to access the actions panel of the IBM Cloud Functions dashboard](resources/parameters.png \"Click on the Parameters button\")\n\nThis will load the \"Parameters\" view. Click \"Add Parameter\" button (highlighted in purple)\n\n![An image showing how to access the actions panel of the IBM Cloud Functions dashboard](resources/add_parameter.png \"Add a parameter\")\n\nThen create a parameter with the name `invocation_secret` and set a value (essentially a password for your function) and then click save (highlighted in red). Don't forget to put double quotes around your parameter value.\n\n![An image showing how to access the actions panel of the IBM Cloud Functions dashboard](resources/safe_password.png \"Create an invocation secret\")\n\nAnd that's it, we're good to go!\n\nGo back to the \"Endpoints\" view and then copy the HTTP URL for your serverless function (highlighted in green) and then open up a terminal window.\n\n![An image showing how to access the actions panel of the IBM Cloud Functions dashboard](resources/public_url.png \"Copy your public URL\")\n\nIn your terminal window, enter the following cURL command to compile the dependencies for any Node.js serverless function.\n\n`curl -X POST -H \"Content-Type: application/json\" -d @\u003cPATH TO YOUR package.json FILE\u003e \u003cTHE URL YOU JUST COPIED\u003e?secret=\u003cYOUR INVOCATION_SECRET VALUE\u003e -o deps.tar.gz`\n\nOnce the request is completed, you will have a new file called `deps.tar.gz` which contains your newly compiled `node_modules` directory. Now you can package them up and deploy them however you like.\n\n![An image showing how to access the actions panel of the IBM Cloud Functions dashboard](resources/great_success.png \"Great success!\")\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fseanmtracey%2Fopenwhisk-dependency-compiler","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fseanmtracey%2Fopenwhisk-dependency-compiler","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fseanmtracey%2Fopenwhisk-dependency-compiler/lists"}