Kashif Hussain Dahri
Kashif Hussain Dahri

Reputation: 19

Netlify Page Not Found Error (Not able to deploy serverless express backend to NETLIFY)

Can anyone help me to deploy ExpressJS on netlify ????? Source Code Link: https://github.com/Kashif852/0067-server2 Netlify Deployed Page link which showing page not found error: https://vigorous-einstein-a3f15a.netlify.app/

Upvotes: 0

Views: 967

Answers (1)

kebenny
kebenny

Reputation: 51

I encountered similar problem and solved by follow sample code at https://github.com/netlify-labs/netlify-functions-express by using netlify-lambda as build tool.

Installed netlify-lambda

npm install netlify-lambda

and updated "scripts" in package.json by using netlify-lambda in start and build. It works.

"scripts": {
    "start": "netlify-lambda serve functions",
    "build": "netlify-lambda build functions"

In Netlify's document at https://docs.netlify.com/functions/build-with-javascript/ . It seems "Netlify Dev" is preferable than netlify-lambda.

Netlify Dev – Netlify CLI includes tools for local function development and streamlined deployment through a simulated Netlify production environment. The netlify dev command starts a framework server if a framework is detected and handles redirects, proxy rules, Netlify Functions, and add-ons.

netlify-lambda – We provide an optional build tool for Netlify Functions that is no longer recommended for new projects or common use cases. The repository README includes a comparison between Netlify Dev and netlify-lambda.

However, in my case, I can only build by netlify-lambda.

Upvotes: 0

Related Questions