Home
Support Forums

Stripe payments not working on Netlify while working locally and on heroku (with same code)

Hello,

Struggling with this for a while now, I have a site with stripe payments that works fine when I run on local and when I deploy on heroku but the payments url fails on Netlify. I use the same branch, deploying directly from git.

I am new to node.js, react and Netlify itself so I’m expecting some newbie mistakes, sorry.

Thanks in advance for any help and please let me know if there is anything else I can attach to help find the problem clearer.

Cheers!

netlify site name: wonderful-poitras-b1eb16
netlify site url: https://pc-remotesupport.com/
heroku site url: https://pc-remotesupport.herokuapp.com/

  • Build problems? Link or paste the FULL build log & build settings screenshot

Deploy Log:
2:45:57 PM: Build ready to start
2:45:59 PM: build-image version: d84c79427e8f83c1ba17bcdd7b3fe38059376b68
2:45:59 PM: build-image tag: v3.6.1
2:45:59 PM: buildbot version: d35018babe252245044d3565f193fa426818b4b1
2:45:59 PM: Fetching cached dependencies
2:45:59 PM: Starting to download cache of 207.2MB
2:46:08 PM: Finished downloading cache in 9.561871617s
2:46:08 PM: Starting to extract cache
2:46:16 PM: Finished extracting cache in 8.139048769s
2:46:17 PM: Finished fetching cache in 17.852191482s
2:46:17 PM: Starting to prepare the repo for build
2:46:17 PM: Preparing Git Reference refs/heads/master
2:46:19 PM: Different publish path detected, going to use the one specified in the Netlify configuration file: ‘client/build’ versus ‘/client/build’ in the Netlify UI
2:46:19 PM: Starting build script
2:46:19 PM: Installing dependencies
2:46:19 PM: Python version set to 2.7
2:46:20 PM: Started restoring cached node version
2:46:23 PM: Finished restoring cached node version
2:46:24 PM: v12.18.0 is already installed.
2:46:25 PM: Now using node v12.18.0 (npm v6.14.4)
2:46:25 PM: Started restoring cached build plugins
2:46:25 PM: Finished restoring cached build plugins
2:46:25 PM: Attempting ruby version 2.7.1, read from environment
2:46:27 PM: Using ruby version 2.7.1
2:46:27 PM: Using PHP version 5.6
2:46:27 PM: Started restoring cached node modules
2:46:27 PM: Finished restoring cached node modules
2:46:28 PM: Started restoring cached go cache
2:46:28 PM: Finished restoring cached go cache
2:46:28 PM: go version go1.14.4 linux/amd64
2:46:28 PM: go version go1.14.4 linux/amd64
2:46:28 PM: Installing missing commands
2:46:28 PM: Verify run directory
2:46:30 PM: ​
2:46:30 PM: ────────────────────────────────────────────────────────────────
2:46:30 PM: Netlify Build
2:46:30 PM: ────────────────────────────────────────────────────────────────
2:46:30 PM: ​
2:46:30 PM: ❯ Version
2:46:30 PM: @netlify/build 9.0.0
2:46:30 PM: ​
2:46:30 PM: ❯ Flags
2:46:30 PM: deployId: 601d5a25016eb7fcb600ab7e
2:46:30 PM: mode: buildbot
2:46:30 PM: ​
2:46:30 PM: ❯ Current directory
2:46:30 PM: /opt/build/repo
2:46:30 PM: ​
2:46:30 PM: ❯ Config file
2:46:30 PM: No config file was defined: using default values.
2:46:30 PM: ​
2:46:30 PM: ❯ Context
2:46:30 PM: production
2:46:30 PM: ​
2:46:30 PM: ────────────────────────────────────────────────────────────────
2:46:30 PM: 1. Build command from Netlify app
2:46:30 PM: ────────────────────────────────────────────────────────────────
2:46:30 PM: ​
2:46:30 PM: $ npm run build
2:46:30 PM: > pcremotesupportserver@1.0.0 build /opt/build/repo
2:46:30 PM: > cd client && npm run build
2:46:31 PM: > pcremotesupport@0.1.0 build /opt/build/repo/client
2:46:31 PM: > react-scripts build
2:46:33 PM: Creating an optimized production build…
2:47:28 PM: Compiled successfully.
2:47:28 PM:
2:47:28 PM: File sizes after gzip:
2:47:28 PM: 280.54 KB build/static/js/2.1199fb77.chunk.js
2:47:28 PM: 24.49 KB build/static/css/main.8050ee5f.chunk.css
2:47:28 PM: 22.68 KB build/static/css/2.3c328e4c.chunk.css
2:47:28 PM: 18.86 KB build/static/js/main.456f4c16.chunk.js
2:47:28 PM: 775 B build/static/js/runtime-main.272e0a56.js
2:47:28 PM: The project was built assuming it is hosted at /.
2:47:28 PM: You can control this with the homepage field in your package.json.
2:47:28 PM: The build folder is ready to be deployed.
2:47:28 PM: You may serve it with a static server:
2:47:28 PM: npm install -g serve
2:47:28 PM: serve -s build
2:47:28 PM: Find out more about deployment here:
2:47:28 PM: https://cra.link/deployment
2:47:28 PM: ​
2:47:28 PM: (build.command completed in 58s)
2:47:28 PM: ​
2:47:28 PM: ────────────────────────────────────────────────────────────────
2:47:28 PM: 2. Deploy site
2:47:28 PM: ────────────────────────────────────────────────────────────────
2:47:28 PM: ​
2:47:28 PM: Starting to deploy site from ‘client/build’
2:47:28 PM: Creating deploy tree
2:47:28 PM: Creating deploy upload records
2:47:28 PM: 8 new files to upload
2:47:28 PM: 0 new functions to upload
2:47:28 PM: Site deploy was successfully initiated
2:47:28 PM: ​
2:47:28 PM: (Deploy site completed in 489ms)
2:47:28 PM: ​
2:47:28 PM: ────────────────────────────────────────────────────────────────
2:47:28 PM: Netlify Build Complete
2:47:28 PM: ────────────────────────────────────────────────────────────────
2:47:28 PM: ​
2:47:28 PM: (Netlify Build completed in 58.6s)
2:47:29 PM: Caching artifacts
2:47:29 PM: Starting post processing
2:47:29 PM: Started saving node modules
2:47:29 PM: Finished saving node modules
2:47:29 PM: Started saving build plugins
2:47:29 PM: Finished saving build plugins
2:47:29 PM: Post processing - HTML
2:47:29 PM: Started saving pip cache
2:47:29 PM: Finished saving pip cache
2:47:29 PM: Started saving emacs cask dependencies
2:47:29 PM: Post processing - header rules
2:47:29 PM: Finished saving emacs cask dependencies
2:47:29 PM: Started saving maven dependencies
2:47:29 PM: Post processing - redirect rules
2:47:29 PM: Finished saving maven dependencies
2:47:29 PM: Started saving boot dependencies
2:47:29 PM: Post processing done
2:47:29 PM: Finished saving boot dependencies
2:47:29 PM: Started saving rust rustup cache
2:47:29 PM: Finished saving rust rustup cache
2:47:29 PM: Started saving go dependencies
2:47:29 PM: Finished saving go dependencies
2:47:29 PM: Build script success
2:47:29 PM: Site is live :sparkles:

Deploy Settings:

servers package.json:

{

“name”: “pcremotesupportserver”,

“version”: “1.0.0”,

“engines”: {

"node": "12.18.0",

"npm": "6.14.4"

},

“scripts”: {

"client": "cd client && npm start",

"server": "nodemon server.js",

"build": "cd client && npm run build",

"dev": "concurrently --kill-others-on-fail \"npm run server\" \"npm run client\"",

"start": "node server.js",

"heroku-postbuild": "cd client && npm install && npm install --only=dev --no-shrinkwrap && npm run build"

},

“dependencies”: {

"@restart/hooks": "^0.3.25",

"axios": "^0.21.1",

"body-parser": "^1.18.3",

"bootstrap": "^4.5.3",

"compression": "1.7.4",

"cors": "2.8.5",

"dotenv": "7.0.0",

"express": "^4.17.1",

"express-sslify": "^1.2.0",

"firebase": "^8.2.1",

"jquery": "^3.5.1",

"lodash.memoize": "^4.1.2",

"node-sass": "^4.14.1",

"popper.js": "^1.16.1",

"react-bootstrap": "^1.4.0",

"react-redux": "^7.2.2",

"react-router-dom": "^5.2.0",

"react-scripts": "^4.0.1",

"react-stripe-checkout": "^2.6.3",

"redux": "^4.0.5",

"redux-logger": "^3.0.6",

"redux-persist": "^6.0.0",

"redux-saga": "^1.1.3",

"reselect": "^4.0.0",

"stripe": "6.28.0",

"styled-components": "^5.2.1"

},

“devDependencies”: {

"@types/dotenv": "^8.2.0",

"concurrently": "^4.0.1",

"nodemon": "^1.19.4",

"react": "^16.14.0",

"react-dom": "^16.14.0"

}

}

Client package.json:

{

“name”: “pcremotesupport”,

“version”: “0.1.0”,

“private”: true,

“proxy”: “http://localhost:5000”,

“dependencies”: {

"@testing-library/jest-dom": "^4.2.4",

"@testing-library/react": "^9.5.0",

"@testing-library/user-event": "^7.2.1",

"axios": "^0.19.2",

"firebase": "^7.24.0",

"node-sass": "^4.14.1",

"react": "^16.14.0",

"react-dom": "^16.13.0",

"react-redux": "^7.2.2",

"react-router-dom": "^5.2.0",

"react-scripts": "^3.4.0",

"react-stripe-checkout": "^2.6.3",

"redux": "^4.0.5",

"redux-logger": "^3.0.6",

"redux-persist": "^6.0.0",

"redux-saga": "^1.1.3",

"redux-thunk": "^2.3.0",

"reselect": "^4.0.0",

"styled-components": "^5.2.1"

},

“scripts”: {

"start": "react-scripts start",

"build": "react-scripts build",

"test": "react-scripts test",

"eject": "react-scripts eject"

},

“eslintConfig”: {

"extends": "react-app"

},

“browserslist”: {

"production": [

  ">0.2%",

  "not dead",

  "not op_mini all"

],

"development": [

  "last 1 chrome version",

  "last 1 firefox version",

  "last 1 safari version"

]

}

}

Hi there, sorry to be slow to respond. Can you tell us a little bit more information please? Are you trying to use a function to interface with stripe? Are you trying to run a server on Netlify?

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

Thanks, I realized soon after I posted that the backend can’t be run on netlify and since there were no replies to the original post, I forgot I even posted this question :sweat_smile: . I am now using the lambda function for stripe purposes now and all is good.
Cheers

1 Like