Our site, https://carvel.dev, is being deployed with hugo and netlify via connection with github. On our site, we run an interactive playground which currently calls out to a lambda function we have set up in AWS, responding at url: https://get-ytt.io/template.
My goal is to deploy this lambda function using Netlify. Currently I build and zip up executables into template.zip
, which includes two binaries build with go 1.17, main
and ytt
. We build these binaries separately so that the website does not have a dependency on a large project. The zip file is committed to the netlify/functions
directory, and pushed to my branch (playground-integration) which has an open draft PR.
During the deploy process, I see the logs saying that the function was recognized:
12:13:20 PM: ────────────────────────────────────────────────────────────────
12:13:20 PM: 1. build.command from netlify.toml
12:13:20 PM: ────────────────────────────────────────────────────────────────
12:13:20 PM: $ hugo --gc --minify --buildFuture -b $DEPLOY_PRIME_URL
12:13:20 PM: Start building sites …
12:13:20 PM: | EN
12:13:20 PM: -------------------+------
12:13:20 PM: Pages | 190
12:13:20 PM: Paginator pages | 0
12:13:20 PM: Non-page files | 5
12:13:20 PM: Static files | 137
12:13:20 PM: Processed images | 0
12:13:20 PM: Aliases | 1
12:13:20 PM: Sitemaps | 1
12:13:20 PM: Cleaned | 0
12:13:20 PM: Total in 829 ms
12:13:21 PM:
12:13:21 PM: (build.command completed in 913ms)
12:13:21 PM:
12:13:21 PM: ────────────────────────────────────────────────────────────────
12:13:21 PM: 2. Functions bundling
12:13:21 PM: ────────────────────────────────────────────────────────────────
12:13:21 PM:
12:13:21 PM: Packaging Functions from netlify/functions directory:
12:13:21 PM: - template.zip
12:13:21 PM:
12:13:21 PM:
12:13:21 PM: (Functions bundling completed in 117ms)
12:13:21 PM:
12:13:21 PM: ────────────────────────────────────────────────────────────────
12:13:21 PM: 3. Deploy site
12:13:21 PM: ────────────────────────────────────────────────────────────────
12:13:21 PM:
12:13:21 PM: Starting to deploy site from 'site/public'
12:13:21 PM: Creating deploy tree
12:13:21 PM: Creating deploy upload records
12:13:21 PM: 193 new files to upload
12:13:21 PM: 1 new functions to upload
12:13:31 PM: Site deploy was successfully initiated
12:13:31 PM:
12:13:31 PM: (Deploy site completed in 10.5s)
However, when I test the new endpoint for the function, I get an error:
{
"errorType": "Runtime.ImportModuleError",
"errorMessage": "Error: Cannot find module 'template'\nRequire stack:\n- /var/runtime/UserFunction.js\n- /var/runtime/index.js",
"trace": [
"Runtime.ImportModuleError: Error: Cannot find module 'template'",
"Require stack:",
"- /var/runtime/UserFunction.js",
"- /var/runtime/index.js",
" at _loadUserApp (/var/runtime/UserFunction.js:202:13)",
" at Object.module.exports.load (/var/runtime/UserFunction.js:242:17)",
" at Object.<anonymous> (/var/runtime/index.js:43:30)",
" at Module._compile (internal/modules/cjs/loader.js:1085:14)",
" at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)",
" at Module.load (internal/modules/cjs/loader.js:950:32)",
" at Function.Module._load (internal/modules/cjs/loader.js:790:12)",
" at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:76:12)",
" at internal/main/run_main_module.js:17:47"
]
}
I work with my team on our open source project Carvel, any help would be appreciated. Thanks.