question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Unable to deploy this library on Netlify or next-serverless, cannot resolve 'fast-crc32c'

See original GitHub issue

Describe the bug Unfortunately, it appears that this library cannot be built when the next.config.js defines a target: serverless. An error occurs stating the following:

ModuleNotFoundError: Module not found: Error: Can't resolve 'fast-crc32c' in '/Users/jordan/GitHub/next-firebase-auth/example/node_modules/hash-stream-validation'

Both next-serverless and netlify require defining the target as serverless to be deployed using their libraries/services. Apparently target: serverless deploys an individual lambda for each page that needs it and I guess the firebase-admin package that relies on hash-stream-validation expects a nodejs environment to execute properly and cannot be bundled with webpack? I’m not an expert but that’s sort of what I’ve picked up and I hope someone with more knowledge in this area can pick up from here.

Version 0.13.2

To Reproduce

  • Use the example directory found in this repo
  • Add target: serverless to the next.config.js
  • Run npm run build

Expected behavior I expect to be able to build my project using target: serverless without errors so I can deploy on services such as Netlify or on next-serverless.

Additional context I apologize as I do not have a solution for this issue, there was a ticket opened and promptly closed in this repo regarding the same problem with no resolution here:

https://github.com/gladly-team/next-firebase-auth/issues/235

Also a Discussion opened with no response here:

https://github.com/gladly-team/next-firebase-auth/discussions/225

So I figured I’d open this and actively contribute to figuring out the problem with others here. Please let me know what I can do to help!


Edit: As an aside, I suppose it makes sense right? When I install firebase-admin to my next app, it detects it’s not a server environment so dependencies such as fast-crc32c are not installed in my node_modules like they are for an express app. That’s why I receive the Module not found error. The question now is, how do we prevent webpack from throwing an error when attempting to build the project since it detects that missing dependency?

A workaround is to just manually install the fast-crc32c package, however this does not work well when sharing projects to team members as they’ll need to manually install the packages after a traditional npm install …just a thought.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:3
  • Comments:7 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
uncvrdcommented, Aug 16, 2021

@izio38 technically you can fork the project comment out any references to firebase-admin where it’s imported (removing the local dependency of fb admin in your project too) and it’ll build / deploy.

OR you can just manually install the node dependencies required. But highly do not recommend as collaboration will be a pain as theyll not auto install with ‘npm i’.

But I just switched to Vercel instead and it works great

0reactions
IzioDevcommented, Aug 16, 2021

@uncvrd I am using the serverless component : @sls-next/serverless-component@3.2.0.

And I ran into your issue. Did you found a solution in-order-to build the nextjs application into a serverless environment ?

Thanks.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Module not found: Error: Can't resolve 'fast-crc32c' #235 - GitHub
Module not found: Error: Can't resolve 'fast-crc32c' #235 ... Unable to deploy this library on Netlify or next-serverless, cannot resolve ...
Read more >
Cannot deploy Next.js to Netlify. Deploy failed due to an error ...
Try doing this and this worked for me. In netlify, under your project, do this. Site Settings -> Plugins -> Next. js Runtime...
Read more >
Error deploy next 12.1.5 - Netlify Support Forums
I'm having the following issue deploying Next.JS to netlify. Please find below error log and package.json: { "name": "ng", "version": "0.1.0", ...
Read more >
Error with SWR when deploying Next.js to Netlify - Support
Hi all, I'm having a problem with deployment on Netlify. I'm trying to deploy a branch that uses useSWR. In the first deployment, ......
Read more >
Netlify won't deploy my Next.js+Prisma app
I'm having trouble deploying this basic Next.js app with Prisma to Netlify: GitHub - jhackett1/example-deploy-to-netlify-app It fails with a ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found