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

--frozen-lockfile failed issue #7

Closed
NicholasMKim opened this issue Mar 9, 2022 · 2 comments
Closed

--frozen-lockfile failed issue #7

NicholasMKim opened this issue Mar 9, 2022 · 2 comments

Comments

@NicholasMKim
Copy link

NicholasMKim commented Mar 9, 2022

Hi team, I'm very struggling to use prisma with webpack and serverless,
I'm getting an error like this one. Anyone has a clue? Error: yarn install --non-interactive --frozen-lockfile failed with code 1

This is what my codes looks like
package.json

{
  "name": "[name]",
  "version": "1.0.0",
  "description": "",
  "main": "app.ts",
  "scripts": {
    "start": "sls offline",
  },
  "dependencies": {
    "@prisma/client": "^3.9.2",
    "@swifthome/core": "^1.0.19",
    "api-gateway-auth-policy": "^1.0.1",
    "body-parser": "^1.19.2",
    "class-transformer": "^0.3.1",
    "class-validator": "^0.12.2",
    "cors": "^2.8.5",
    "express": "^4.17.1",
    "firebase-admin": "^10.0.2",
    "lodash": "^4.17.21",
    "multer": "^1.4.4",
    "nanoid": "^3.3.1",
    "reflect-metadata": "^0.1.13",
    "routing-controllers": "^0.9.0"
  },
  "devDependencies": {
    "@aws-sdk/client-sesv2": "^3.53.0",
    "@aws-sdk/client-sns": "^3.53.0",
    "@types/body-parser": "^1.19.2",
    "@types/express": "^4.17.13",
    "@types/multer": "^1.4.7",
    "@types/validator": "^13.7.1",
    "aws-sdk": "^2.1082.0",
    "copy-webpack-plugin": "^10.2.4",
    "serverless": "^3.7.1",
    "serverless-http": "^2.7.0",
    "serverless-offline": "^8.4.0",
    "serverless-plugin-typescript": "^2.1.1",
    "serverless-webpack": "^5.6.1",
    "serverless-webpack-prisma": "^1.0.10",
    "ts-loader": "^9.2.7",
    "typescript": "^4.6.2",
    "webpack": "^5.70.0",
    "webpack-node-externals": "^3.0.0"
  }
}

serverless.yml

org: [name]
app: [name]
service: [name]
frameworkVersion: "3"

provider:
  name: aws
  runtime: nodejs14.x
  stage: dev

plugins:
  - serverless-webpack
  # - serverless-plugin-typescript
  - serverless-webpack-prisma
  - serverless-offline

functions: [functions]
  
package:
  individually: true
  patterns:
    - '!node_modules/.prisma/client/libquery_engine-*'
    - 'node_modules/.prisma/client/libquery_engine-rhel-*'
    - '!node_modules/prisma/libquery_engine-*'
    - '!node_modules/@prisma/engines/**'
custom:
  webpack:
    packager: "yarn"
    includeModules: true
    packagerOptions:
      scripts:
        - npx prisma generate

webpack.config.js

const slsw = require("serverless-webpack");
const path = require("path");

module.exports = {
  entry: slsw.lib.entries,
  target: "node",
  mode: "production",
  devtool: "inline-source-map",
  output: {
    libraryTarget: "commonjs",
    path: path.resolve(__dirname, ".webpack"), 
    filename: "[name].js",
  },
  resolve: {
    extensions: [".tsx", ".ts", ".js"],
  },
  module: {
    rules: [
      {
        test: /\.tsx?$/,
        use: "ts-loader",
        exclude: /node_modules/,
      },
    ],
  },
  externals: {
    _http_common: "commonjs2 _http_common",
    kcors: "kcors",
  },
};

schema.prisma

generator client {
  provider = "prisma-client-js"
  binaryTargets = ["native", "rhel-openssl-1.0.x"]
}
@NicholasMKim
Copy link
Author

SOLVED: put private packages into allowList
serverless-heaven/serverless-webpack#370 (comment)

@danieluhm2004
Copy link
Owner

Hello.

As you said, for serverless-webpack, there is a problem when installing private packages.

In addition to the above method of handling exceptions, the following methods can also be used.

webpack:
  packagerOptions:
    noFrozenLockfile: true

I will close the issue.
Thank you.

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

2 participants