node.js wants to install local project from github

I want to move my lambda function from AWS amplify to my terraform project.
All the dependencies should be installed in the separate lambda layer.

Here’s my package.json file

{
  "name": "authorizerfunction",
  "version": "2.0.0",
  "description": "Lambda function generated by Amplify",
  "main": "index.ts",
  "license": "Apache-2.0",
  "dependencies": {
    "jwt-decode": "^3.1.2",
    "aws-lambda": "^1.0.7",
    "@types/aws-lambda": "^8.10.97",
    "@types/node": "^18.11.18"
  },
  "devDependencies": {
  }
}
resource "null_resource" "install_dependencies" {
  provisioner "local-exec" {
    command = "npm install --omit=dev --prefix ${local.lambda_layer_output_dir}/nodejs ${local.lambda_source_dir}"
  }

  triggers = {
    always_run = "${timestamp()}"
  }
}

resource "aws_lambda_layer_version" "lambda_layer" {
  filename            = data.archive_file.zip_layer.output_path
  layer_name          = "${local.project_name}-lambda-layer"
  compatible_runtimes = [local.lambda_runtime]
  source_code_hash    = base64sha256(data.archive_file.zip_layer.output_path)
}

resource "aws_lambda_function" "lambda_function" {
  filename         = data.archive_file.zip_the_python_code.output_path
  function_name    = local.project_name
  role             = aws_iam_role.lambda_role.arn
  handler          = "index.handler"
  runtime          = local.lambda_runtime
  layers           = [aws_lambda_layer_version.lambda_layer.arn]
  source_code_hash = base64sha256(data.archive_file.zip_the_python_code.output_path)
  depends_on = [
    aws_iam_role_policy_attachment.attach_iam_policy_to_iam_role
  ]
}

data "archive_file" "zip_the_python_code" {
  type        = "zip"
  source_dir  = "${local.lambda_source_dir}/"
  output_path = local.lambda_zip_path
  excludes    = ["package.json", "package-lock.json", "tsconfig.json"]
}

data "archive_file" "zip_layer" {
  type        = "zip"
  source_dir  = "${local.lambda_layer_output_dir}/"
  output_path = local.lambda_layer_zip_path
  depends_on  = [null_resource.install_dependencies]
}

locals {
  project_name = "AuthorizerFunction2-${terraform.workspace}"

  lambda_zip_file_name       = "lambda.zip"
  lambda_zip_path            = "${path.module}/${local.lambda_zip_file_name}"
  lambda_source_dir          = "${path.module}/lambda"
  lambda_layer_zip_file_name = "layer.zip"
  lambda_layer_zip_path      = "${path.module}/${local.lambda_layer_zip_file_name}"
  lambda_layer_output_dir    = "${path.module}/lambda_layer_files"
  lambda_runtime             = "nodejs14.x"
}

When it comes to apply the changes, I got some weird error because the npm install command from null_resource resource expects my project to be a github repository.

│ Error: local-exec provisioner error
│ 
│   with module.authorizer_function.null_resource.install_dependencies,
│   on authorizer_function/lambda.tf line 2, in resource "null_resource" "install_dependencies":
│    2:   provisioner "local-exec" {
│ 
│ Error running command 'npm install --omit=dev --prefix
│ authorizer_function/lambda_layer_files/nodejs authorizer_function/lambda':
│ exit status 128. Output: npm error code 128
│ npm error An unknown git error occurred
│ npm error command git --no-replace-objects ls-remote
│ ssh://[email protected]/authorizer_function/lambda.git
│ npm error [email protected]: Permission denied (publickey).
│ npm error fatal: Could not read from remote repository.
│ npm error
│ npm error Please make sure you have the correct access rights
│ npm error and the repository exists.
│ 
│ npm error A complete log of this run can be found in:
│ /root/.npm/_logs/2024-09-26T09_25_53_181Z-debug-0.log
│ 

1

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật