Stuck on deploy express / next app to netlify

I’m stuck to deploy my Next/Express app on Netlify.

The app works fine locally but when I want to build on using Netlify lambda function it doesn’t work.

Here my git repos for some test :

(use npm install first and npm run dev)

If I only use next build script, the app can be deployed but I can’t use express but if I use the Netlify script netlify-lambda build (src/directory) I get this error:

Can’t resolve ‘pnpapi’ in ‘…/Express_Next/node_modules/pnp-webpack-plugin’

If I use the basically script server.js (without next configuration) it works but not locally.

When I build create-react-app with Express it works but I want to use Next.js + Express.js.

hi there, before we dig in, are you trying to deploy a server to netlify? that won’t work.

Here is a good summary of what you can and can not do on Netlify you might find helpful:

Hi ! Thanks for reply :slightly_smiling_face:

Yes I have trying with react / express and it works but not with next / express.

I read the documentation and gave up Express in favor of Api routes.

I was finally able to deploy the application on Netlify :slight_smile:

All I have to do is configure my database with MongoDb so that I can use it online.

1 Like

awesome! let us know how it goes.