Error: Cannot find module 'sharp' in Netlify Function log with NextJS and previews

Adding the included_files property with a value of ["node_modules/sharp/**/*"] solved the issue!

What’s funny is I had read that thread a day prior to writing my post and saw that the original poster had the property in their configuration file, but they had no success with it so I never tried it. Great timing that they responded!

@Kimfucious, I did install sharp first and had made sure to reference it in my netlify.toml under the external_node_modules property, but unfortunately had no luck. I had found that solution from a thread you had started actually! :slight_smile:

Thank you guys for the help!

My only question is why adding the external_node_modules property wasn’t enough to include it in the Netlify function deployment in this particular instance?