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

Aws Lambda can't have this package #50

Open
igrevkr opened this issue Jun 4, 2024 · 1 comment
Open

Aws Lambda can't have this package #50

igrevkr opened this issue Jun 4, 2024 · 1 comment

Comments

@igrevkr
Copy link

igrevkr commented Jun 4, 2024

Hi, I'm aiden.

I'm currently having a trouble building a serverless node server(AWS Lambda).
The errors are like this below.

`yarn run v1.22.22
$ nest build --webpack
ERROR in ./node_modules/farmhash/build/Release/farmhash.node 1:0
Module parse failed: Unexpected character '�' (1:0)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
(Source code omitted for this binary file)
@ ./node_modules/farmhash/index.js 5:11-51
@ ./node_modules/firebase-admin/lib/remote-config/condition-evaluator-internal.js 21:17-36
@ ./node_modules/firebase-admin/lib/remote-config/remote-config.js 22:39-80
@ ./node_modules/firebase-admin/lib/app/firebase-namespace.js 219:29-83
@ ./node_modules/firebase-admin/lib/default-namespace.js 19:29-64
@ ./node_modules/firebase-admin/lib/index.js 19:17-47
@ ./src/sms/sms.service.ts 33:12-37
@ ./src/sms/sms.module.ts 40:22-46
@ ./src/app.module.ts 19:21-48
@ ./src/lambda.ts 34:21-44

ERROR in ./node_modules/farmhash/index.js 7:11-49
Module not found: Error: Can't resolve './build/Debug/farmhash.node' in '/home/runner/work/backend_v1/backend_v1/node_modules/farmhash'
resolve './build/Debug/farmhash.node' in '/home/runner/work/backend_v1/backend_v1/node_modules/farmhash'
using description file: /home/runner/work/backend_v1/backend_v1/node_modules/farmhash/package.json (relative path: .)
using description file: /home/runner/work/backend_v1/backend_v1/node_modules/farmhash/package.json (relative path: ./build/Debug/farmhash.node)
no extension
/home/runner/work/backend_v1/backend_v1/node_modules/farmhash/build/Debug/farmhash.node doesn't exist
.tsx
/home/runner/work/backend_v1/backend_v1/node_modules/farmhash/build/Debug/farmhash.node.tsx doesn't exist
.ts
/home/runner/work/backend_v1/backend_v1/node_modules/farmhash/build/Debug/farmhash.node.ts doesn't exist
.js
/home/runner/work/backend_v1/backend_v1/node_modules/farmhash/build/Debug/farmhash.node.js doesn't exist
as directory
/home/runner/work/backend_v1/backend_v1/node_modules/farmhash/build/Debug/farmhash.node doesn't exist
@ ./node_modules/firebase-admin/lib/remote-config/condition-evaluator-internal.js 21:17-36
@ ./node_modules/firebase-admin/lib/remote-config/remote-config.js 22:39-80
@ ./node_modules/firebase-admin/lib/app/firebase-namespace.js 219:29-83
@ ./node_modules/firebase-admin/lib/default-namespace.js 19:29-64
@ ./node_modules/firebase-admin/lib/index.js 19:17-47
@ ./src/sms/sms.service.ts 33:12-37
@ ./src/sms/sms.module.ts 40:22-46
@ ./src/app.module.ts 19:21-48
@ ./src/lambda.ts 34:21-44

webpack 5.90.1 compiled with 2 errors in 68925 ms
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
Error: Process completed with exit code 1.
##[debug]Finishing: Run yarn build:serverless`

The errors started since I added "firebase-admin" package into the system.
But the firebase-admin doesn't use this 'farmhash' package directly.
It should be one of the firebase-admin's 3rd party packages.

I guess Lambda can't handle this type of expression. (using . relative path)
return require('./build/Release/farmhash.node'); } catch (e) { return require('./build/Debug/farmhash.node');

Do you know how to solve this issue?
I can't move on and update the system because of this.
Please help me out if you have time.

Thank you.

@lovell
Copy link
Owner

lovell commented Jun 4, 2024

It looks like you're using Webpack. Did you see #46 (comment) ?

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