Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

What are the prerequisites on the local machine? #7

Open
couling opened this issue Mar 21, 2023 · 1 comment
Open

What are the prerequisites on the local machine? #7

couling opened this issue Mar 21, 2023 · 1 comment

Comments

@couling
Copy link

couling commented Mar 21, 2023

I don't see any discussion in the README of what the prerequisites are on the local machine for running this. I've installed node with brew install node. But on my mac I'm still getting an error on one of the null resources:

│ Error: local-exec provisioner error
│ 
│   with module.cloudfront_auth.null_resource.build_lambda,
│   on .terraform/modules/cloudfront_auth/main.tf line 38, in resource "null_resource" "build_lambda":
│   38:   provisioner "local-exec" {
│ 
│ Error running command 'cd build/cloudfront-auth-master && node build/build.js --AUTH_VENDOR='google' --CLOUDFRONT_DISTRIBUTION='blog.couling.uk'
│ --CLIENT_ID='xxx' --CLIENT_SECRET='xxx' --REDIRECT_URI='https://example.com/callback' --SESSION_DURATION='1' --AUTHZ="1"
│ --HD="example.com"': exit status 1. Output: node:internal/modules/cjs/loader:1093
│   throw err;
│   ^
│ 
│ Error: Cannot find module 'shelljs'
│ Require stack:
│ - /Users/philip/Documents/Development/scratch/biket/build/cloudfront-auth-master/build/build.js
│     at Module._resolveFilename (node:internal/modules/cjs/loader:1090:15)
│     at Module._load (node:internal/modules/cjs/loader:934:27)
│     at Module.require (node:internal/modules/cjs/loader:1157:19)
│     at require (node:internal/modules/helpers:119:18)
│     at Object.<anonymous> (/Users/philip/Documents/Development/scratch/biket/build/cloudfront-auth-master/build/build.js:1:15)
│     at Module._compile (node:internal/modules/cjs/loader:1275:14)
│     at Module._extensions..js (node:internal/modules/cjs/loader:1329:10)
│     at Module.load (node:internal/modules/cjs/loader:1133:32)
│     at Module._load (node:internal/modules/cjs/loader:972:12)
│     at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:83:12) {
│   code: 'MODULE_NOT_FOUND',
│   requireStack: [
│     '/Users/philip/Documents/Development/scratch/biket/build/cloudfront-auth-master/build/build.js'
│   ]
│ }
│ 
│ Node.js v19.8.1
│ 
╵

@couling
Copy link
Author

couling commented Mar 21, 2023

Even after using npm install -g to install:

shelljs
prompt
axios
colors
ramda
minimist

And setting the environment variable: NODE_PATH=/usr/local/lib/node_modules...

Terraform will apply. But then I get an error suggesting the lambda is failing. Running a test, the lambda says:

Runtime.ImportModuleError: Error: Cannot find module 'jsonwebtoken'"

And I can confirm that no nodejs dependencies were packaged inside the lambda.

At this point I'm totally stuck.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant