Deploying a static website with a backend api

Hi! I’m a Web Development student and a complete newbie to working with Netflify. I’ve previously deployed this site with Heroku for a class assignment but wanted to deploy it with Netlify instead.

I followed all the steps I did back in Heroku and I’m able to deploy the front-end of the site but I can’t seem to get the back-end to run. It might be a simple thing I’m overlooking but for the life of me I can’t seem to figure it out so I’m kindly asking for some guidance. I have a hunch that it’s something related to the scripts as the environment variables are correctly set.

I’ve also attempted using the AI bot to ask why the deployment failed but it didn’t reply with anything useful.

if it helps, the build command of the successful deploys is npm run build as for the failed ones is npm run dev in hopes to get the api to also start up.

Site name: https://cbmovietracker.netlify.app/
Github: https://github.com/BurgosCoralis-FS/authentication

Full Build Logs:

5:17:12 PM: Waiting for other deploys from your team to complete. Check the queue: https://app.netlify.com/teams/burgoscoralis-fs/builds
5:17:16 PM: Build ready to start
5:17:28 PM: build-image version: 3d3c7e8b4321e2c1a54a2c4584fb46ba742b1630 (focal)
5:17:28 PM: buildbot version: 72ed9578274f76ae72cdce4c5312615aeecc32fb
5:17:28 PM: Fetching cached dependencies
5:17:28 PM: Starting to download cache of 67.5MB
5:17:29 PM: Finished downloading cache in 845ms
5:17:29 PM: Starting to extract cache
5:17:30 PM: Finished extracting cache in 693ms
5:17:30 PM: Finished fetching cache in 1.58s
5:17:30 PM: Starting to prepare the repo for build
5:17:30 PM: Preparing Git Reference refs/heads/master
5:17:31 PM: Custom build path detected. Proceeding with the specified path: ''
5:17:32 PM: Starting to install dependencies
5:17:32 PM: Python version set to 3.8
5:17:32 PM: Attempting Ruby version 2.7.2, read from environment
5:17:33 PM: Using Ruby version 2.7.2
5:17:33 PM: Started restoring cached go cache
5:17:33 PM: Finished restoring cached go cache
5:17:34 PM: go version go1.19.13 linux/amd64
5:17:35 PM: Using PHP version 8.0
5:17:36 PM: Started restoring cached Node.js version
5:17:37 PM: Finished restoring cached Node.js version
5:17:37 PM: v18.20.2 is already installed.
5:17:38 PM: Now using node v18.20.2 (npm v10.5.0)
5:17:38 PM: Enabling Node.js Corepack
5:17:38 PM: Started restoring cached build plugins
5:17:38 PM: Finished restoring cached build plugins
5:17:38 PM: WARNING: The environment variable 'NODE_ENV' is set to 'production'. Any 'devDependencies' in package.json will not be installed
5:17:38 PM: Started restoring cached corepack dependencies
5:17:38 PM: Finished restoring cached corepack dependencies
5:17:38 PM: No npm workspaces detected
5:17:38 PM: Started restoring cached node modules
5:17:38 PM: Finished restoring cached node modules
5:17:38 PM: Installing npm packages using npm version 10.5.0
5:17:38 PM: npm WARN EBADENGINE Unsupported engine {
5:17:38 PM: npm WARN EBADENGINE   package: 'authentication@1.0.0',
5:17:38 PM: npm WARN EBADENGINE   required: { node: '21.6.2' },
5:17:38 PM: npm WARN EBADENGINE   current: { node: 'v18.20.2', npm: '10.5.0' }
5:17:38 PM: npm WARN EBADENGINE }
5:17:39 PM: > authentication@1.0.0 install
5:17:39 PM: > npm install --prefix client && npm install --prefix api
5:17:47 PM: npm WARN deprecated @babel/plugin-proposal-private-methods@7.18.6: This proposal has been merged to the ECMAScript standard and thus this plugin is no longer maintained. Please use @babel/plugin-transform-private-methods instead.
5:17:47 PM: npm WARN deprecated @babel/plugin-proposal-numeric-separator@7.18.6: This proposal has been merged to the ECMAScript standard and thus this plugin is no longer maintained. Please use @babel/plugin-transform-numeric-separator instead.
5:17:47 PM: npm WARN deprecated @babel/plugin-proposal-nullish-coalescing-operator@7.18.6: This proposal has been merged to the ECMAScript standard and thus this plugin is no longer maintained. Please use @babel/plugin-transform-nullish-coalescing-operator instead.
5:17:47 PM: npm WARN deprecated @babel/plugin-proposal-class-properties@7.18.6: This proposal has been merged to the ECMAScript standard and thus this plugin is no longer maintained. Please use @babel/plugin-transform-class-properties instead.
5:17:47 PM: npm WARN deprecated stable@0.1.8: Modern JS already guarantees Array#sort() is a stable sort, so this library is deprecated. See the compatibility table on MDN: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort#browser_compatibility
5:17:47 PM: npm WARN deprecated rollup-plugin-terser@7.0.2: This package has been deprecated and is no longer maintained. Please use @rollup/plugin-terser
5:17:47 PM: npm WARN deprecated abab@2.0.6: Use your platform's native atob() and btoa() methods instead
npm WARN deprecated domexception@2.0.1: Use your platform's native DOMException instead
npm WARN deprecated sourcemap-codec@1.4.8: Please use @jridgewell/sourcemap-codec instead
5:17:48 PM: npm WARN deprecated w3c-hr-time@1.0.2: Use your platform's native performance.now() and performance.timeOrigin.
npm WARN deprecated @babel/plugin-proposal-optional-chaining@7.21.0: This proposal has been merged to the ECMAScript standard and thus this plugin is no longer maintained. Please use @babel/plugin-transform-optional-chaining instead.
5:17:49 PM: npm WARN deprecated workbox-cacheable-response@6.6.0: workbox-background-sync@6.6.0
5:17:49 PM: npm WARN deprecated workbox-google-analytics@6.6.0: It is not compatible with newer versions of GA starting with v4, as long as you are using GAv3 it should be ok, but the package is not longer being maintained
5:17:50 PM: npm WARN deprecated svgo@1.3.2: This SVGO version is no longer supported. Upgrade to v2.x.x.
5:17:53 PM: added 1566 packages, and audited 1567 packages in 14s
5:17:53 PM: 258 packages are looking for funding
5:17:53 PM:   run `npm fund` for details
5:17:53 PM: 11 vulnerabilities (4 moderate, 7 high)
5:17:53 PM: To address issues that do not require attention, run:
5:17:53 PM:   npm audit fix
5:17:53 PM: To address all issues (including breaking changes), run:
5:17:53 PM:   npm audit fix --force
5:17:53 PM: Run `npm audit` for details.
5:17:54 PM: npm WARN deprecated bcrypt-nodejs@0.0.3: bcrypt-nodejs is no longer actively maintained. Please use bcrypt or bcryptjs. See https://github.com/kelektiv/node.bcrypt.js/wiki/bcrypt-vs-brypt.js to learn more about these two options
5:17:55 PM: added 144 packages, and audited 145 packages in 1s
5:17:55 PM: 18 packages are looking for funding
5:17:55 PM:   run `npm fund` for details
5:17:55 PM: 1 moderate severity vulnerability
5:17:55 PM: To address all issues, run:
5:17:55 PM:   npm audit fix
5:17:55 PM: Run `npm audit` for details.
5:17:55 PM: up to date, audited 31 packages in 16s
5:17:55 PM: 7 packages are looking for funding
5:17:55 PM:   run `npm fund` for details
5:17:55 PM: found 0 vulnerabilities
5:17:55 PM: npm packages installed
5:17:55 PM: Successfully installed dependencies
5:17:55 PM: Starting build script
5:17:56 PM: Detected 0 framework(s)
5:17:56 PM: Section completed: initializing
5:17:58 PM: ​
5:17:58 PM: Netlify Build                                                 
5:17:58 PM: ────────────────────────────────────────────────────────────────
5:17:58 PM: ​
5:17:58 PM: ❯ Version
5:17:58 PM:   @netlify/build 29.41.3
5:17:58 PM: ​
5:17:58 PM: ❯ Flags
5:17:58 PM:   baseRelDir: true
5:17:58 PM:   buildId: 6643d4d8654e120008d0d5df
5:17:58 PM:   deployId: 6643d4d8654e120008d0d5e1
5:17:58 PM: ​
5:17:58 PM: ❯ Current directory
5:17:58 PM:   /opt/build/repo
5:17:58 PM: ​
5:17:58 PM: ❯ Config file
5:17:58 PM:   No config file was defined: using default values.
5:17:58 PM: ​
5:17:58 PM: ❯ Context
5:17:58 PM:   production
5:17:58 PM: ​
5:17:58 PM: Build command from Netlify app                                
5:17:58 PM: ────────────────────────────────────────────────────────────────
5:17:58 PM: ​
5:17:58 PM: $ npm run dev
5:17:58 PM: > authentication@1.0.0 dev
5:17:58 PM: > concurrently --raw "npm run start-api" "npm run build-client"
5:17:58 PM: > authentication@1.0.0 start-api
5:17:58 PM: > npm start --prefix api
5:17:58 PM: > authentication@1.0.0 build-client
5:17:58 PM: > npm run build --prefix client
5:17:58 PM: > api@1.0.0 start
5:17:58 PM: > node server.js
5:17:58 PM: > reactjs@0.1.0 build
5:17:58 PM: > react-scripts build
5:17:59 PM: (node:5490) [MONGODB DRIVER] Warning: useNewUrlParser is a deprecated option: useNewUrlParser has no effect since Node.js Driver version 4.0.0 and will be removed in the next major version
5:17:59 PM: (Use `node --trace-warnings ...` to show where the warning was created)
5:17:59 PM: server is running on 9000
5:17:59 PM: Database Connection Established
5:17:59 PM: Creating an optimized production build...
5:18:03 PM: One of your dependencies, babel-preset-react-app, is importing the
5:18:03 PM: "@babel/plugin-proposal-private-property-in-object" package without
5:18:03 PM: declaring it in its dependencies. This is currently working because
5:18:03 PM: "@babel/plugin-proposal-private-property-in-object" is already in your
5:18:03 PM: node_modules folder for unrelated reasons, but it may break at any time.
5:18:03 PM: babel-preset-react-app is part of the create-react-app project, which
5:18:03 PM: is not maintianed anymore. It is thus unlikely that this bug will
5:18:03 PM: ever be fixed. Add "@babel/plugin-proposal-private-property-in-object" to
5:18:03 PM: your devDependencies to work around this error. This will make this message
5:18:03 PM: go away.
5:18:05 PM: Compiled successfully.
5:18:05 PM: 
5:18:05 PM: File sizes after gzip:
5:18:05 PM:   66.1 kB  build/static/js/main.c8001cbf.js
5:18:05 PM:   1.77 kB  build/static/js/453.3669db72.chunk.js
5:18:05 PM:   998 B    build/static/css/main.2cc872a5.css
5:18:05 PM: The project was built assuming it is hosted at /.
5:18:05 PM: You can control this with the homepage field in your package.json.
5:18:05 PM: The build folder is ready to be deployed.
5:18:05 PM: You may serve it with a static server:
5:18:05 PM:   npm install -g serve
5:18:05 PM:   serve -s build
5:18:05 PM: Find out more about deployment here:
5:18:05 PM:   https://cra.link/deployment
5:35:55 PM: Failed during stage 'building site': Command did not finish within the time limit
5:35:55 PM: Execution timed out after 17m59.82177512s
5:35:55 PM: Failing build: Failed to build site
5:35:56 PM: Finished processing build request in 18m27.867s

Thank you so much in advance for taking the time to read this and help! Please let me know if any more information is required.

@cb98 It’s unlikely you could run this project on Netlify in its current form.

Netlify doesn’t provide the type of Node.js hosting it would utilize.

See:

You would need to make a change like:

  1. Adjust the backend so that it uses Serverless Functions.
    or
  2. Host the backend elsewhere (e.g Render) and proxy to it.

In any case, on Netlify you don’t want to run your dev command which starts a server.
You won’t be able to connect to it and it’ll just sit there consuming build minutes until it times out.

Thank you so much! It’s my first time using Netlify and I’m still learning about how builds can be deployed. I’ll be looking more into it but thank you for pointing me in the right direction!

We have docs for Express which could be useful: Express on Netlify | Netlify Docs