Logo-amall

I have a serverless functions i use it with hasura actions. Work fine in local. But i got this deploy error. I have no installed packages such as "mock-aws-s3". couldn't build lambda for /tmp/1693465139/functions/insert-user-password.ts: ✘ [ERROR] Could not resolve "mock-aws-s3" node_modules/@mapbox/node-pre-gyp/lib/util/s3_setup.js:43:28: 43 │ const AWSMock = require('mock-aws-s3'); ╵ ~~~~~~~~~~~~~ You can mark the path "mock-aws-s3" as external to exclude it from the bundle, which will remove this error. You can also surround this "require" call with a try/catch block to handle this failure at run-time instead of bundle-time. ✘ [ERROR] Could not resolve "aws-sdk" node_modules/@mapbox/node-pre-gyp/lib/util/s3_setup.js:76:22: 76 │ const AWS = require('aws-sdk'); ╵ ~~~~~~~~~ You can mark the path "aws-sdk" as external to exclude it from the bundle, which will remove this error. You can also surround this "require" call with a try/catch block to handle this failure at run-time instead of bundle-time. ✘ [ERROR] Could not resolve "nock" node_modules/@mapbox/node-pre-gyp/lib/util/s3_setup.js:112:23: 112 │ const nock = require('nock'); ╵ ~~~~~~ You can mark the path "nock" as external to exclude it from the bundle, which will remove this error. You can also surround this "require" call with a try/catch block to handle this failure at run-time instead of bundle-time. 3 errors

Last active 3 months ago

13 replies

15 views

  • EM

    I have a serverless functions i use it with hasura actions. Work fine in local. But i got this deploy error. I have no installed packages such as "mock-aws-s3".

    couldn't build lambda for /tmp/1693465139/functions/insert-user-password.ts: ✘ [ERROR] Could not resolve "mock-aws-s3" nodemodules/@mapbox/node-pre-gyp/lib/util/s3setup.js:43:28: 43 │ const AWSMock = require('mock-aws-s3'); ╵ ~~~~~~~~~~~~~ You can mark the path "mock-aws-s3" as external to exclude it from the bundle, which will remove this error. You can also surround this "require" call with a try/catch block to handle this failure at run-time instead of bundle-time. ✘ [ERROR] Could not resolve "aws-sdk" nodemodules/@mapbox/node-pre-gyp/lib/util/s3setup.js:76:22: 76 │ const AWS = require('aws-sdk'); ╵ ~~~~~~~~~ You can mark the path "aws-sdk" as external to exclude it from the bundle, which will remove this error. You can also surround this "require" call with a try/catch block to handle this failure at run-time instead of bundle-time. ✘ [ERROR] Could not resolve "nock" nodemodules/@mapbox/node-pre-gyp/lib/util/s3setup.js:112:23: 112 │ const nock = require('nock'); ╵ ~~~~~~ You can mark the path "nock" as external to exclude it from the bundle, which will remove this error. You can also surround this "require" call with a try/catch block to handle this failure at run-time instead of bundle-time. 3 errors

  • EL

    @emrneo Would you mind sharing your package.json here?

  • EM

    {
    "name": "functions",
    "version": "1.0.0",
    "description": ""
    "main": "index.js",
    "devDependencies": {
    "@types/bcrypt": "^5.0.0"
    },
    "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
    },
    "keywords": [],
    "author": "",
    "license": "ISC",
    "dependencies": {
    "@types/express": "^4.17.14",
    "bcrypt": "^5.1.0",
    "node-fetch": "^3.2.10"
    }
    }

  • EM

    @elitan

  • EL

    Sorry, nothing stands out from this package.json

  • EL

    Are you able to publicly post the serverless function code?

  • EL

    Looks to be related to mapbox?

  • EL

    and I don't understand why. You don't have a lot of packages in your package.json

  • EM

    Works fine in local

  • EL

    Can you try using bcryptjs instead of bcrypt. I think bcrypts uses a binary and we have issues with that in our infra atm. Similar to this: https://github.com/nhost/nhost/issues/933

  • EL

    bcryptjs: https://www.npmjs.com/package/bcryptjs

  • TA

    I ran into this issue recently as well. Switching from pnpm to yarn to manage my packages made it work.

  • EM

    @TaylorFay Altough i use yarn i had this issue. Maybe some c++ codes of bcrypt conflict with nhost infra.

Last active 3 months ago

13 replies

15 views