Skip to content

Issues with Netlify Lambda #491

Closed
Closed
@renatodex

Description

@renatodex

[REQUIRED] Step 2: Describe your environment

  • Operating System version: MacOS 10.14 (Mojave)
  • Firebase SDK version: latest
  • Library version: firebase-admin 7.1.1
  • Firebase Product: database

[REQUIRED] Step 3: Describe the problem

Firebase Admin have problems being Bundled by netlify-lambda Webpack Config.
Check it out this thread to understand the whole story.
netlify/netlify-lambda#112

Steps to reproduce:

Shell

yarn add firebase-admin
yarn add netlify-lambda

functions/index.js

import * as Firebase from 'firebase-admin'

exports.handler = (event, context, callback) => callback(null, {
  statusCode: 200,
  body: 'OK'
})

Try to Build: (shell)

netlify-lambda build

Error output

netlify-lambda: Starting server
Lambda server is listening on 9000
Hash: e3817619e6c76f23fc78
Version: webpack 4.29.0
Time: 3102ms
Built at: 02/02/2019 11:53:21 PM
      Asset      Size  Chunks             Chunk Names
firebase.js  2.72 MiB       0  [emitted]  firebase
Entrypoint firebase = firebase.js
 [10] external "fs" 42 bytes {0} [built]
 [12] ../node_modules/firebase-admin/lib/utils/error.js 34.8 KiB {0} [built]
 [14] ../node_modules/firebase-admin/lib/utils/validator.js 7.25 KiB {0} [built]
 [56] ../node_modules/firebase-admin/lib/utils/deep-copy.js 2.6 KiB {0} [built]
[115] ../node_modules/firebase-admin/lib/auth/credential.js 15 KiB {0} [built]
[235] ../node_modules/firebase-admin/lib/index.js 1.36 KiB {0} [built]
[261] ../node_modules/firebase-admin/lib/auth/auth.js 20.5 KiB {0} [built]
[262] ../node_modules/@firebase/database/dist/index.esm.js 592 KiB {0} [built]
[264] ../node_modules/firebase-admin/lib/messaging/messaging.js 48.8 KiB {0} [built]
[265] ../node_modules/firebase-admin/lib/storage/storage.js 4.98 KiB {0} [built]
[354] ../node_modules/@google-cloud/firestore/build/src/index.js 52.9 KiB {0} [built]
[422] ./components/serviceAccountKey.json 2.32 KiB {0} [built]
[423] ./firebase.js 1.17 KiB {0} [built]
[424] ../node_modules/firebase-admin/lib/default-namespace.js 1.16 KiB {0} [built]
[425] ../node_modules/firebase-admin/lib/firebase-namespace.js 18.4 KiB {0} [built]
    + 780 hidden modules

WARNING in ../node_modules/grpc/src/grpc_extension.js 32:12-33
Critical dependency: the request of a dependency is an expression
 @ ../node_modules/grpc/index.js
 @ ../node_modules/google-gax/build/src/grpc.js
 @ ../node_modules/google-gax/build/src/index.js
 @ ../node_modules/@google-cloud/firestore/build/src/v1beta1/firestore_client.js
 @ ../node_modules/@google-cloud/firestore/build/src/v1beta1/index.js
 @ ../node_modules/@google-cloud/firestore/build/src/index.js
 @ ../node_modules/firebase-admin/lib/firebase-namespace.js
 @ ../node_modules/firebase-admin/lib/default-namespace.js
 @ ../node_modules/firebase-admin/lib/index.js
 @ ./firebase.js

WARNING in ../node_modules/grpc/node_modules/node-pre-gyp/lib/pre-binding.js 20:22-48
Critical dependency: the request of a dependency is an expression
 @ ../node_modules/grpc/src/grpc_extension.js
 @ ../node_modules/grpc/index.js
 @ ../node_modules/google-gax/build/src/grpc.js
 @ ../node_modules/google-gax/build/src/index.js
 @ ../node_modules/@google-cloud/firestore/build/src/v1beta1/firestore_client.js
 @ ../node_modules/@google-cloud/firestore/build/src/v1beta1/index.js
 @ ../node_modules/@google-cloud/firestore/build/src/index.js
 @ ../node_modules/firebase-admin/lib/firebase-namespace.js
 @ ../node_modules/firebase-admin/lib/default-namespace.js
 @ ../node_modules/firebase-admin/lib/index.js
 @ ./firebase.js

WARNING in ../node_modules/grpc/node_modules/node-pre-gyp/lib/util/versioning.js 17:20-67
Critical dependency: the request of a dependency is an expression
 @ ../node_modules/grpc/node_modules/node-pre-gyp/lib/pre-binding.js
 @ ../node_modules/grpc/src/grpc_extension.js
 @ ../node_modules/grpc/index.js
 @ ../node_modules/google-gax/build/src/grpc.js
 @ ../node_modules/google-gax/build/src/index.js
 @ ../node_modules/@google-cloud/firestore/build/src/v1beta1/firestore_client.js
 @ ../node_modules/@google-cloud/firestore/build/src/v1beta1/index.js
 @ ../node_modules/@google-cloud/firestore/build/src/index.js
 @ ../node_modules/firebase-admin/lib/firebase-namespace.js
 @ ../node_modules/firebase-admin/lib/default-namespace.js
 @ ../node_modules/firebase-admin/lib/index.js
 @ ./firebase.js

WARNING in ../node_modules/hash-stream-validation/index.js
Module not found: Error: Can't resolve 'fast-crc32c' in '/repos/test/node_modules/hash-stream-validation'
 @ ../node_modules/hash-stream-validation/index.js
 @ ../node_modules/@google-cloud/storage/build/src/file.js
 @ ../node_modules/@google-cloud/storage/build/src/index.js
 @ ../node_modules/firebase-admin/lib/storage/storage.js
 @ ../node_modules/firebase-admin/lib/firebase-namespace.js
 @ ../node_modules/firebase-admin/lib/default-namespace.js
 @ ../node_modules/firebase-admin/lib/index.js
 @ ./firebase.js

WARNING in ../node_modules/bytebuffer/dist/bytebuffer-node.js
Module not found: Error: Can't resolve 'memcpy' in '/repos/test/node_modules/bytebuffer/dist'
 @ ../node_modules/bytebuffer/dist/bytebuffer-node.js
 @ ../node_modules/protobufjs/dist/protobuf.js
 @ ../node_modules/grpc/index.js
 @ ../node_modules/google-gax/build/src/grpc.js
 @ ../node_modules/google-gax/build/src/index.js
 @ ../node_modules/@google-cloud/firestore/build/src/v1beta1/firestore_client.js
 @ ../node_modules/@google-cloud/firestore/build/src/v1beta1/index.js
 @ ../node_modules/@google-cloud/firestore/build/src/index.js
 @ ../node_modules/firebase-admin/lib/firebase-namespace.js
 @ ../node_modules/firebase-admin/lib/default-namespace.js
 @ ../node_modules/firebase-admin/lib/index.js
 @ ./firebase.js

WARNING in ../node_modules/write-file-atomic/index.js
Module not found: Error: Can't resolve 'worker_threads' in '/repos/test/node_modules/write-file-atomic'
 @ ../node_modules/write-file-atomic/index.js
 @ ../node_modules/gcs-resumable-upload/node_modules/configstore/index.js
 @ ../node_modules/gcs-resumable-upload/build/src/index.js
 @ ../node_modules/@google-cloud/storage/build/src/file.js
 @ ../node_modules/@google-cloud/storage/build/src/index.js
 @ ../node_modules/firebase-admin/lib/storage/storage.js
 @ ../node_modules/firebase-admin/lib/firebase-namespace.js
 @ ../node_modules/firebase-admin/lib/default-namespace.js
 @ ../node_modules/firebase-admin/lib/index.js
 @ ./firebase.js

Relevant Information

This code is running on Node Server Side. (so, its not a Client-Use issue)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions