openshiporg / openship

multi-channel fulfillment at scale
https://openship.org
GNU Affero General Public License v3.0
1.04k stars 75 forks source link

Build fails on Netlify #2

Closed RoneoOrg closed 2 years ago

RoneoOrg commented 2 years ago

Hi there,

I've tested the "One Click deploy to Netlify" button from the readme and here is the result from the Netlify build logs:

6:51:11 PM: $ yarn build
6:51:11 PM: yarn run v1.22.10
6:51:11 PM: $ keystone prisma migrate deploy && next build
6:51:15 PM: Prisma schema loaded from schema.prisma
6:51:15 PM: Error: Get config: Schema Parsing P1012
6:51:15 PM: 
6:51:15 PM: error: Environment variable not found: DATABASE_URL.
6:51:15 PM:   -->  schema.prisma:5
6:51:15 PM:    |
6:51:15 PM:  4 | datasource postgresql {
6:51:15 PM:  5 |   url               = env("DATABASE_URL")
6:51:15 PM:    |
6:51:15 PM: Validation Error Count: 1
6:51:15 PM: error Command failed with exit code 1. (https://ntl.fyi/exit-code-1)

Here is the full report; OTH:

6:50:11 PM: Build ready to start
6:50:12 PM: build-image version: d7b3dbfb0846505993c9a131894d1858074c90b4 (focal)
6:50:12 PM: build-image tag: v4.10.1
6:50:12 PM: buildbot version: 67e75f1ba713a8213d4b5a8ccf9708af751e2390
6:50:12 PM: Fetching cached dependencies
6:50:13 PM: Failed to fetch cache, continuing with build
6:50:13 PM: Starting to prepare the repo for build
6:50:13 PM: No cached dependencies found. Cloning fresh repo
6:50:13 PM: git clone https://github.com/openshiporg/openship
6:50:13 PM: Preparing Git Reference refs/heads/main
6:50:13 PM: Parsing package.json dependencies
6:50:14 PM: Starting build script
6:50:14 PM: Installing dependencies
6:50:14 PM: Python version set to 2.7
6:50:15 PM: Downloading and installing node v16.17.0...
6:50:15 PM: Downloading https://nodejs.org/dist/v16.17.0/node-v16.17.0-linux-x64.tar.xz...
6:50:15 PM: Computing checksum with sha256sum
6:50:15 PM: Checksums matched!
6:50:17 PM: Now using node v16.17.0 (npm v8.15.0)
6:50:17 PM: Started restoring cached build plugins
6:50:17 PM: Finished restoring cached build plugins
6:50:17 PM: Attempting ruby version 2.7.2, read from environment
6:50:18 PM: Using ruby version 2.7.2
6:50:18 PM: Using PHP version 8.0
6:50:18 PM: Started restoring cached yarn cache
6:50:18 PM: Finished restoring cached yarn cache
6:50:19 PM: No yarn workspaces detected
6:50:19 PM: Started restoring cached node modules
6:50:19 PM: Finished restoring cached node modules
6:50:19 PM: Installing NPM modules using Yarn version 1.22.10
6:50:19 PM: npm WARN config tmp This setting is no longer used.  npm stores temporary files in a special
6:50:19 PM: npm WARN config location in the cache, and they are managed by
6:50:19 PM: npm WARN config     [`cacache`](http://npm.im/cacache).
6:50:19 PM: yarn install v1.22.10
6:50:19 PM: [1/5] Validating package.json...
6:50:19 PM: [2/5] Resolving packages...
6:50:19 PM: [3/5] Fetching packages...
6:50:37 PM: info @next/swc-android-arm-eabi@12.2.0: The platform "linux" is incompatible with this module.
6:50:37 PM: info "@next/swc-android-arm-eabi@12.2.0" is an optional dependency and failed compatibility check. Excluding it from installation.
6:50:37 PM: info @next/swc-android-arm-eabi@12.2.0: The CPU architecture "x64" is incompatible with this module.
6:50:37 PM: info @next/swc-android-arm64@12.2.0: The platform "linux" is incompatible with this module.
6:50:37 PM: info "@next/swc-android-arm64@12.2.0" is an optional dependency and failed compatibility check. Excluding it from installation.
6:50:37 PM: info @next/swc-android-arm64@12.2.0: The CPU architecture "x64" is incompatible with this module.
6:50:37 PM: info @next/swc-darwin-arm64@12.2.0: The platform "linux" is incompatible with this module.
6:50:37 PM: info "@next/swc-darwin-arm64@12.2.0" is an optional dependency and failed compatibility check. Excluding it from installation.
6:50:37 PM: info @next/swc-darwin-arm64@12.2.0: The CPU architecture "x64" is incompatible with this module.
6:50:37 PM: info @next/swc-darwin-x64@12.2.0: The platform "linux" is incompatible with this module.
6:50:37 PM: info "@next/swc-darwin-x64@12.2.0" is an optional dependency and failed compatibility check. Excluding it from installation.
6:50:37 PM: info @next/swc-freebsd-x64@12.2.0: The platform "linux" is incompatible with this module.
6:50:37 PM: info "@next/swc-freebsd-x64@12.2.0" is an optional dependency and failed compatibility check. Excluding it from installation.
6:50:37 PM: info @next/swc-linux-arm-gnueabihf@12.2.0: The CPU architecture "x64" is incompatible with this module.
6:50:37 PM: info "@next/swc-linux-arm-gnueabihf@12.2.0" is an optional dependency and failed compatibility check. Excluding it from installation.
6:50:37 PM: info @next/swc-linux-arm64-gnu@12.2.0: The CPU architecture "x64" is incompatible with this module.
6:50:37 PM: info "@next/swc-linux-arm64-gnu@12.2.0" is an optional dependency and failed compatibility check. Excluding it from installation.
6:50:37 PM: info @next/swc-linux-arm64-musl@12.2.0: The CPU architecture "x64" is incompatible with this module.
6:50:37 PM: info "@next/swc-linux-arm64-musl@12.2.0" is an optional dependency and failed compatibility check. Excluding it from installation.
6:50:37 PM: info @next/swc-win32-arm64-msvc@12.2.0: The platform "linux" is incompatible with this module.
6:50:37 PM: info "@next/swc-win32-arm64-msvc@12.2.0" is an optional dependency and failed compatibility check. Excluding it from installation.
6:50:37 PM: info @next/swc-win32-arm64-msvc@12.2.0: The CPU architecture "x64" is incompatible with this module.
6:50:37 PM: info @next/swc-win32-ia32-msvc@12.2.0: The platform "linux" is incompatible with this module.
6:50:37 PM: info "@next/swc-win32-ia32-msvc@12.2.0" is an optional dependency and failed compatibility check. Excluding it from installation.
6:50:37 PM: info @next/swc-win32-ia32-msvc@12.2.0: The CPU architecture "x64" is incompatible with this module.
6:50:37 PM: info @next/swc-win32-x64-msvc@12.2.0: The platform "linux" is incompatible with this module.
6:50:37 PM: info "@next/swc-win32-x64-msvc@12.2.0" is an optional dependency and failed compatibility check. Excluding it from installation.
6:50:37 PM: info fsevents@2.3.2: The platform "linux" is incompatible with this module.
6:50:37 PM: info "fsevents@2.3.2" is an optional dependency and failed compatibility check. Excluding it from installation.
6:50:37 PM: [4/5] Linking dependencies...
6:50:37 PM: warning "@keystone-6/auth > @keystone-ui/core > @emotion/react > @emotion/babel-plugin@11.9.2" has unmet peer dependency "@babel/core@^7.0.0".
6:50:37 PM: warning "@keystone-6/auth > @keystone-ui/fields > react-day-picker > @reach/auto-id@0.16.0" has incorrect peer dependency "react@^16.8.0 || 17.x".
6:50:37 PM: warning "@keystone-6/auth > @keystone-ui/fields > react-day-picker > @reach/auto-id@0.16.0" has incorrect peer dependency "react-dom@^16.8.0 || 17.x".
6:50:37 PM: warning "@keystone-6/auth > @keystone-ui/core > @emotion/react > @emotion/babel-plugin > @babel/plugin-syntax-jsx@7.18.6" has unmet peer dependency "@babel/core@^7.0.0-0".
6:50:37 PM: warning "@keystone-6/auth > @keystone-ui/fields > react-day-picker > @reach/auto-id > @reach/utils@0.16.0" has incorrect peer dependency "react@^16.8.0 || 17.x".
6:50:37 PM: warning "@keystone-6/auth > @keystone-ui/fields > react-day-picker > @reach/auto-id > @reach/utils@0.16.0" has incorrect peer dependency "react-dom@^16.8.0 || 17.x".
6:50:37 PM: warning "@keystone-6/core > @aws-sdk/lib-storage@3.121.0" has unmet peer dependency "@aws-sdk/abort-controller@^3.0.0".
6:50:37 PM: warning "@keystone-6/core > @prisma/migrate@3.14.0" has unmet peer dependency "@prisma/generator-helper@*".
6:50:37 PM: warning "@mantine/core > @radix-ui/react-scroll-area@0.1.4" has incorrect peer dependency "react@^16.8 || ^17.0".
6:50:37 PM: warning "@mantine/core > @radix-ui/react-scroll-area > @radix-ui/react-compose-refs@0.1.0" has incorrect peer dependency "react@^16.8 || ^17.0".
6:50:37 PM: warning "@mantine/core > @radix-ui/react-scroll-area > @radix-ui/react-context@0.1.1" has incorrect peer dependency "react@^16.8 || ^17.0".
6:50:37 PM: warning "@mantine/core > @radix-ui/react-scroll-area > @radix-ui/react-primitive@0.1.4" has incorrect peer dependency "react@^16.8 || ^17.0".
6:50:37 PM: warning "@mantine/core > @radix-ui/react-scroll-area > @radix-ui/react-use-callback-ref@0.1.0" has incorrect peer dependency "react@^16.8 || ^17.0".
6:50:37 PM: warning "@mantine/core > @radix-ui/react-scroll-area > @radix-ui/react-use-direction@0.1.0" has incorrect peer dependency "react@^16.8 || ^17.0".
6:50:37 PM: warning "@mantine/core > @radix-ui/react-scroll-area > @radix-ui/react-use-layout-effect@0.1.0" has incorrect peer dependency "react@^16.8 || ^17.0".
6:50:37 PM: warning "@mantine/core > @radix-ui/react-scroll-area > @radix-ui/react-primitive > @radix-ui/react-slot@0.1.2" has incorrect peer dependency "react@^16.8 || ^17.0".
6:50:37 PM: warning "@mantine/next > @mantine/ssr > html-react-parser@1.3.0" has incorrect peer dependency "react@0.14 || 15 || 16 || 17".
6:50:37 PM: warning " > graphql-request@3.7.0" has unmet peer dependency "graphql@14 - 16".
6:50:37 PM: warning "next-pwa > babel-loader@8.2.5" has unmet peer dependency "@babel/core@^7.0.0".
6:50:37 PM: warning "next-pwa > babel-loader@8.2.5" has unmet peer dependency "webpack@>=2".
6:50:37 PM: warning "next-pwa > clean-webpack-plugin@4.0.0" has unmet peer dependency "webpack@>=4.0.0 <6.0.0".
6:50:37 PM: warning "next-pwa > terser-webpack-plugin@5.3.3" has unmet peer dependency "webpack@^5.1.0".
6:50:37 PM: warning "next-pwa > workbox-webpack-plugin@6.5.4" has unmet peer dependency "webpack@^4.4.0 || ^5.9.0".
6:50:49 PM: [5/5] Building fresh packages...
6:50:53 PM: $ keystone postinstall
6:50:56 PM: ✨ GraphQL and Prisma schemas are up to date
6:50:57 PM: Done in 38.39s.
6:50:57 PM: NPM modules installed using Yarn
6:50:58 PM: Started restoring cached go cache
6:50:58 PM: Finished restoring cached go cache
6:50:58 PM: Installing Go version 1.17 (requested 1.17)
6:51:02 PM: unset GOOS;
6:51:02 PM: unset GOARCH;
6:51:02 PM: export GOROOT='/opt/buildhome/.gimme/versions/go1.17.linux.amd64';
6:51:02 PM: export PATH="/opt/buildhome/.gimme/versions/go1.17.linux.amd64/bin:${PATH}";
6:51:02 PM: go version >&2;
6:51:02 PM: export GIMME_ENV="/opt/buildhome/.gimme/env/go1.17.linux.amd64.env"
6:51:02 PM: go version go1.17 linux/amd64
6:51:02 PM: Installing missing commands
6:51:02 PM: Verify run directory
6:51:03 PM: ​
6:51:03 PM: ────────────────────────────────────────────────────────────────
6:51:03 PM:   Netlify Build                                                 
6:51:03 PM: ────────────────────────────────────────────────────────────────
6:51:03 PM: ​
6:51:03 PM: ❯ Version
6:51:03 PM:   @netlify/build 27.16.1
6:51:03 PM: ​
6:51:03 PM: ❯ Flags
6:51:03 PM:   baseRelDir: true
6:51:03 PM:   buildId: 63123443b8121f02bbd07e5a
6:51:03 PM:   deployId: 63123443b8121f02bbd07e5c
6:51:03 PM: ​
6:51:03 PM: ❯ Current directory
6:51:03 PM:   /opt/build/repo
6:51:03 PM: ​
6:51:03 PM: ❯ Config file
6:51:03 PM:   No config file was defined: using default values.
6:51:03 PM: ​
6:51:03 PM: ❯ Context
6:51:03 PM:   production
6:51:03 PM: ​
6:51:03 PM: ❯ Installing plugins
6:51:03 PM:    - @netlify/plugin-nextjs@4.21.1
6:51:10 PM: ​
6:51:10 PM: ❯ Loading plugins
6:51:10 PM:    - @netlify/plugin-nextjs@4.21.1 from Netlify app
6:51:10 PM: ​
6:51:10 PM: ────────────────────────────────────────────────────────────────
6:51:10 PM:   1. @netlify/plugin-nextjs (onPreBuild event)                  
6:51:10 PM: ────────────────────────────────────────────────────────────────
6:51:10 PM: ​
6:51:11 PM: No Next.js cache to restore.
6:51:11 PM: Netlify configuration property "build.environment.NEXT_PRIVATE_TARGET" value changed.
6:51:11 PM: ​
6:51:11 PM: (@netlify/plugin-nextjs onPreBuild completed in 14ms)
6:51:11 PM: ​
6:51:11 PM: ────────────────────────────────────────────────────────────────
6:51:11 PM:   2. Build command from Netlify app                             
6:51:11 PM: ────────────────────────────────────────────────────────────────
6:51:11 PM: ​
6:51:11 PM: $ yarn build
6:51:11 PM: yarn run v1.22.10
6:51:11 PM: $ keystone prisma migrate deploy && next build
6:51:15 PM: Prisma schema loaded from schema.prisma
6:51:15 PM: Error: Get config: Schema Parsing P1012
6:51:15 PM: 
6:51:15 PM: error: Environment variable not found: DATABASE_URL.
6:51:15 PM:   -->  schema.prisma:5
6:51:15 PM:    |
6:51:15 PM:  4 | datasource postgresql {
6:51:15 PM:  5 |   url               = env("DATABASE_URL")
6:51:15 PM:    |
6:51:15 PM: Validation Error Count: 1
6:51:15 PM: error Command failed with exit code 1. (https://ntl.fyi/exit-code-1)
6:51:15 PM: info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
6:51:15 PM: ​
6:51:15 PM: ────────────────────────────────────────────────────────────────
6:51:15 PM:   "build.command" failed                                        
6:51:15 PM: ────────────────────────────────────────────────────────────────
6:51:15 PM: ​
6:51:15 PM:   Error message
6:51:15 PM:   Command failed with exit code 1: yarn build (https://ntl.fyi/exit-code-1)
6:51:15 PM: ​
6:51:15 PM:   Error location
6:51:15 PM:   In Build command from Netlify app:
6:51:15 PM:   yarn build
6:51:15 PM: ​
6:51:15 PM:   Resolved config
6:51:15 PM:   build:
6:51:15 PM:     command: yarn build
6:51:15 PM:     commandOrigin: ui
6:51:15 PM:     environment:
6:51:15 PM:       - NEXT_PRIVATE_TARGET
6:51:15 PM:     publish: /opt/build/repo/.next
6:51:15 PM:     publishOrigin: ui
6:51:15 PM:   plugins:
6:51:15 PM:     - inputs: {}
6:51:15 PM:       origin: ui
6:51:15 PM:       package: '@netlify/plugin-nextjs'
6:51:16 PM: Caching artifacts
6:51:16 PM: Started saving node modules
6:51:16 PM: Finished saving node modules
6:51:16 PM: Started saving build plugins
6:51:16 PM: Finished saving build plugins
6:51:16 PM: Started saving yarn cache
6:51:20 PM: Finished saving yarn cache
6:51:20 PM: Started saving pip cache
6:51:20 PM: Finished saving pip cache
6:51:20 PM: Started saving emacs cask dependencies
6:51:20 PM: Finished saving emacs cask dependencies
6:51:20 PM: Started saving maven dependencies
6:51:20 PM: Finished saving maven dependencies
6:51:20 PM: Started saving boot dependencies
6:51:20 PM: Finished saving boot dependencies
6:51:20 PM: Started saving rust rustup cache
6:51:20 PM: Finished saving rust rustup cache
6:51:20 PM: Started saving go dependencies
6:51:20 PM: Finished saving go dependencies
6:51:21 PM: Build failed due to a user error: Build script returned non-zero exit code: 2
6:51:21 PM: Creating deploy upload records
6:51:21 PM: Failing build: Failed to build site
6:51:21 PM: Failed during stage 'building site': Build script returned non-zero exit code: 2 (https://ntl.fyi/exit-code-2)
6:51:21 PM: Finished processing build request in 1m8.5871423s
junaid33 commented 2 years ago

You have to go to site settings > build & deploy > environment and add these variables:

FRONTEND_URL=http://localhost:3000
DATABASE_URL=postgresql://postgres:example@url:3000/postgres
SESSION_SECRET=please_change_me

Replace DATABASE_URL with a postgres database connection string and FRONTEND_URL with the url ending in netlify.app. Redeploy the site.

junaid33 commented 2 years ago

I add this to the deployment docs.