Closed noire-munich closed 2 years ago
Very strange. It's as if the '.ts' extension isn't registered in node.
Is there a reproduction branch available that I can test against?
What I thought indeed, couldn't figure out why though :-.
Yeah sure, I'm setting it up on a new project, actually checking if the bug reproduces on the deploy.
You can get it on the main
branch here:
https://github.com/noire-munich/rw-contribution-testing-branches
Ok, I setup a netlify instance with the project and a heroku db, tutorial configuration style.
I added 2 tsconfig.json and renamed db.js
to db.ts
and got this, confirming the issue:
10:35:21 AM: Build ready to start
10:35:23 AM: build-image version: ca811f47d4c1cbd1812d1eb6ecb0c977e86d1a1d
10:35:23 AM: build-image tag: v3.3.20
10:35:23 AM: buildbot version: be8ecf2af866e16fa4301cc5c14de2ccbbb21cf4
10:35:23 AM: Fetching cached dependencies
10:35:23 AM: Failed to fetch cache, continuing with build
10:35:23 AM: Starting to prepare the repo for build
10:35:23 AM: No cached dependencies found. Cloning fresh repo
10:35:23 AM: git clone https://github.com/noire-munich/rw-contribution-testing-branches
10:35:24 AM: Preparing Git Reference refs/heads/main
10:35:25 AM: Different functions path detected, going to use the one specified in the Netlify configuration file: 'api/dist/functions' versus '' in the Netlify UI
10:35:25 AM: Starting build script
10:35:25 AM: Installing dependencies
10:35:25 AM: Python version set to 2.7
10:35:25 AM: Attempting node version 'lts/*' from .nvmrc
10:35:26 AM: Downloading and installing node v12.18.3...
10:35:26 AM: Downloading https://nodejs.org/dist/v12.18.3/node-v12.18.3-linux-x64.tar.xz...
10:35:26 AM: Computing checksum with sha256sum
10:35:26 AM: Checksums matched!
10:35:29 AM: Now using node v12.18.3 (npm v6.14.6)
10:35:29 AM: Started restoring cached build plugins
10:35:29 AM: Finished restoring cached build plugins
10:35:29 AM: Attempting ruby version 2.7.1, read from environment
10:35:31 AM: Using ruby version 2.7.1
10:35:31 AM: Using PHP version 5.6
10:35:31 AM: 5.2 is already installed.
10:35:31 AM: Using Swift version 5.2
10:35:31 AM: Started restoring cached node modules
10:35:31 AM: Finished restoring cached node modules
10:35:31 AM: Started restoring cached yarn cache
10:35:31 AM: Finished restoring cached yarn cache
10:35:31 AM: Installing yarn at version 1.22.4
10:35:31 AM: Installing Yarn!
10:35:31 AM: > Downloading tarball...
10:35:31 AM: [1/2]: https://yarnpkg.com/downloads/1.22.4/yarn-v1.22.4.tar.gz --> /tmp/yarn.tar.gz.85pOnwiBih
10:35:31 AM: % Total % Received % Xferd Average Speed Time Time Time Current
10:35:31 AM: Dload Upload Total Spent Left Speed
10:35:31 AM: 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
10:35:31 AM: 100 80 100 80 0 0 258 0 --:--:-- --:--:-- --:--:-- 259
10:35:32 AM: 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
10:35:32 AM: 100 93 100 93 0 0 147 0 --:--:-- --:--:-- --:--:-- 3444
10:35:32 AM: 100 630 100 630 0 0 700 0 --:--:-- --:--:-- --:--:-- 700
10:35:32 AM: 100 1215k 100 1215k 0 0 814k 0 0:00:01 0:00:01 --:--:-- 814k
10:35:32 AM: [2/2]: https://yarnpkg.com/downloads/1.22.4/yarn-v1.22.4.tar.gz.asc --> /tmp/yarn.tar.gz.85pOnwiBih.asc
10:35:32 AM: 100 84 100 84 0 0 3102 0 --:--:-- --:--:-- --:--:-- 3102
10:35:33 AM: 100 97 100 97 0 0 1761 0 --:--:-- --:--:-- --:--:-- 1761
10:35:33 AM: 100 634 100 634 0 0 7332 0 --:--:-- --:--:-- --:--:-- 7332
10:35:33 AM: 0 1028 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
10:35:33 AM: 100 1028 100 1028 0 0 8134 0 --:--:-- --:--:-- --:--:-- 1003k
10:35:33 AM: > Verifying integrity...
10:35:33 AM: gpg: Signature made Mon 09 Mar 2020 03:52:13 PM UTC using RSA key ID 69475BAA
10:35:33 AM: gpg: Good signature from "Yarn Packaging <yarn@dan.cx>"
10:35:33 AM: gpg: WARNING: This key is not certified with a trusted signature!
10:35:33 AM: gpg: There is no indication that the signature belongs to the owner.
10:35:33 AM: Primary key fingerprint: 72EC F46A 56B4 AD39 C907 BBB7 1646 B01B 86E5 0310
10:35:33 AM: Subkey fingerprint: 6D98 490C 6F1A CDDD 448E 4595 4F77 6793 6947 5BAA
10:35:33 AM: > GPG signature looks good
10:35:33 AM: > Extracting to ~/.yarn...
10:35:33 AM: > Adding to $PATH...
10:35:33 AM: > Successfully installed Yarn 1.22.4! Please open another terminal where the `yarn` command will now be available.
10:35:33 AM: Installing NPM modules using Yarn version 1.22.4
10:35:34 AM: yarn install v1.22.4
10:35:34 AM: [1/5] Validating package.json...
10:35:34 AM: [2/5] Resolving packages...
10:35:35 AM: [3/5] Fetching packages...
10:36:36 AM: info fsevents@1.2.13: The platform "linux" is incompatible with this module.
10:36:36 AM: info "fsevents@1.2.13" is an optional dependency and failed compatibility check. Excluding it from installation.
10:36:36 AM: info fsevents@2.1.3: The platform "linux" is incompatible with this module.
10:36:36 AM: info "fsevents@2.1.3" is an optional dependency and failed compatibility check. Excluding it from installation.
10:36:36 AM: [4/5] Linking dependencies...
10:36:36 AM: warning "@redwoodjs/core > @redwoodjs/testing@0.15.0" has unmet peer dependency "@redwoodjs/router@*".
10:36:36 AM: warning "@redwoodjs/core > @redwoodjs/testing@0.15.0" has unmet peer dependency "react@*".
10:36:36 AM: warning "@redwoodjs/core > @storybook/react@5.3.19" has unmet peer dependency "react@*".
10:36:36 AM: warning "@redwoodjs/core > @storybook/react@5.3.19" has unmet peer dependency "react-dom@*".
10:36:36 AM: warning "@redwoodjs/core > @redwoodjs/testing > @redwoodjs/web@0.15.0" has unmet peer dependency "prop-types@*".
10:36:36 AM: warning "@redwoodjs/core > @redwoodjs/testing > @redwoodjs/web@0.15.0" has unmet peer dependency "react@*".
10:36:36 AM: warning "@redwoodjs/core > @redwoodjs/testing > @testing-library/react@10.0.4" has unmet peer dependency "react@*".
10:36:36 AM: warning "@redwoodjs/core > @redwoodjs/testing > @testing-library/react@10.0.4" has unmet peer dependency "react-dom@*".
10:36:36 AM: warning "@redwoodjs/core > @storybook/react > @storybook/core@5.3.19" has unmet peer dependency "react@*".
10:36:36 AM: warning "@redwoodjs/core > @storybook/react > @storybook/core@5.3.19" has unmet peer dependency "react-dom@*".
10:36:36 AM: warning "@redwoodjs/core > @redwoodjs/testing > @redwoodjs/web > @apollo/react-components@3.1.5" has unmet peer dependency "react@^16.8.0".
10:36:36 AM: warning "@redwoodjs/core > @redwoodjs/testing > @redwoodjs/web > @apollo/react-components@3.1.5" has unmet peer dependency "react-dom@^16.8.0".
10:36:36 AM: warning "@redwoodjs/core > @redwoodjs/testing > @redwoodjs/web > @apollo/react-hooks@3.1.5" has unmet peer dependency "react@^16.8.0".
10:36:36 AM: warning "@redwoodjs/core > @redwoodjs/testing > @redwoodjs/web > @apollo/react-hooks@3.1.5" has unmet peer dependency "react-dom@^16.8.0".
10:36:36 AM: warning "@redwoodjs/core > @redwoodjs/testing > @redwoodjs/web > @redwoodjs/forms@0.15.0" has unmet peer dependency "react@*".
10:36:36 AM: warning "@redwoodjs/core > @storybook/react > @storybook/core > @storybook/router@5.3.19" has unmet peer dependency "react@*".
10:36:36 AM: warning "@redwoodjs/core > @storybook/react > @storybook/core > @storybook/router@5.3.19" has unmet peer dependency "react-dom@*".
10:36:36 AM: warning "@redwoodjs/core > @storybook/react > @storybook/core > @storybook/theming@5.3.19" has unmet peer dependency "react@*".
10:36:36 AM: warning "@redwoodjs/core > @storybook/react > @storybook/core > @storybook/theming@5.3.19" has unmet peer dependency "react-dom@*".
10:36:36 AM: warning "@redwoodjs/core > @redwoodjs/testing > @redwoodjs/web > @apollo/react-components > @apollo/react-common@3.1.4" has unmet peer dependency "react@^16.8.0".
10:36:36 AM: warning "@redwoodjs/core > @redwoodjs/testing > @redwoodjs/web > @redwoodjs/forms > react-hook-form@5.7.2" has unmet peer dependency "react@^16.8.0".
10:36:36 AM: warning "@redwoodjs/core > @storybook/react > @storybook/addons > @storybook/api > @reach/router@1.3.4" has unmet peer dependency "react-dom@15.x || 16.x || 16.4.0-alpha.0911da3".
10:36:36 AM: warning "@redwoodjs/core > @storybook/react > @storybook/core > @storybook/theming > @emotion/core@10.0.28" has unmet peer dependency "react@>=16.3.0".
10:36:36 AM: warning "@redwoodjs/core > @storybook/react > @storybook/core > @storybook/theming > @emotion/styled@10.0.27" has unmet peer dependency "react@>=16.3.0".
10:36:36 AM: warning "@redwoodjs/core > @storybook/react > @storybook/core > @storybook/theming > emotion-theming@10.0.27" has unmet peer dependency "react@>=16.3.0".
10:36:36 AM: warning "@redwoodjs/core > @storybook/react > @storybook/core > @storybook/theming > @emotion/styled > @emotion/styled-base@10.0.31" has unmet peer dependency "react@>=16.3.0".
10:36:58 AM: [5/5] Building fresh packages...
10:37:07 AM: Done in 93.13s.
10:37:07 AM: NPM modules installed using Yarn
10:37:07 AM: Started restoring cached go cache
10:37:07 AM: Finished restoring cached go cache
10:37:07 AM: go version go1.14.4 linux/amd64
10:37:07 AM: go version go1.14.4 linux/amd64
10:37:07 AM: Installing missing commands
10:37:07 AM: Verify run directory
10:37:08 AM:
10:37:08 AM: ┌─────────────────────────────┐
10:37:08 AM: │ Netlify Build │
10:37:08 AM: └─────────────────────────────┘
10:37:08 AM:
10:37:08 AM: ❯ Version
10:37:08 AM: @netlify/build 3.0.1
10:37:08 AM:
10:37:08 AM: ❯ Flags
10:37:08 AM: deployId: 5f23d7c9891cba00070daa14
10:37:08 AM: mode: buildbot
10:37:08 AM:
10:37:08 AM: ❯ Current directory
10:37:08 AM: /opt/build/repo
10:37:08 AM:
10:37:08 AM: ❯ Config file
10:37:08 AM: /opt/build/repo/netlify.toml
10:37:08 AM:
10:37:08 AM: ❯ Context
10:37:08 AM: production
10:37:08 AM:
10:37:08 AM: ❯ Loading plugins
10:37:08 AM: - netlify-plugin-prisma-provider@0.3.0 from netlify.toml and package.json
10:37:10 AM:
10:37:10 AM: ┌───────────────────────────────────────────────────────────┐
10:37:10 AM: │ 1. onPreBuild command from netlify-plugin-prisma-provider │
10:37:10 AM: └───────────────────────────────────────────────────────────┘
10:37:10 AM:
10:37:10 AM: Replacing provider in schema.prisma...
10:37:10 AM: Replaced provider with `provider = "postgresql"` in api/prisma/schema.prisma
10:37:10 AM: Replacing providers in migrations schema.prisma...
10:37:10 AM: Replacing providers in migrations steps.json...
10:37:10 AM:
10:37:10 AM: (netlify-plugin-prisma-provider onPreBuild completed in 13ms)
10:37:10 AM:
10:37:10 AM: ┌────────────────────────────────────┐
10:37:10 AM: │ 2. build.command from netlify.toml │
10:37:10 AM: └────────────────────────────────────┘
10:37:10 AM:
10:37:10 AM: $ yarn rw db up --no-db-client --auto-approve && yarn rw dataMigrate up && yarn rw build
10:37:10 AM: yarn run v1.22.4
10:37:10 AM: $ /opt/build/repo/node_modules/.bin/rw db up --no-db-client --auto-approve
10:37:12 AM: Migrate database up... [started]
10:37:12 AM: $ /opt/build/repo/node_modules/.bin/prisma migrate up --experimental --create-db --auto-approve
10:37:17 AM: 🏋️ migrate up
10:37:17 AM: All migrations are already applied
10:37:17 AM: Migrate database up... [completed]
10:37:17 AM: Done in 6.68s.
10:37:17 AM: yarn run v1.22.4
10:37:17 AM: $ /opt/build/repo/node_modules/.bin/rw dataMigrate up
10:37:19 AM: /opt/build/repo/node_modules/yargs/yargs.js:1242
10:37:19 AM: else throw err
10:37:19 AM: ^
10:37:19 AM: Error: Cannot find module '/opt/build/repo/api/src/lib/db'
10:37:19 AM: Require stack:
10:37:19 AM: - /opt/build/repo/node_modules/@redwoodjs/cli/dist/commands/dataMigrate/up.js
10:37:19 AM: - /opt/build/repo/node_modules/yargs/index.js
10:37:19 AM: - /opt/build/repo/node_modules/@redwoodjs/cli/dist/index.js
10:37:19 AM: at Function.Module._resolveFilename (internal/modules/cjs/loader.js:965:15)
10:37:19 AM: at Function.Module._load (internal/modules/cjs/loader.js:841:27)
10:37:19 AM: at Module.require (internal/modules/cjs/loader.js:1025:19)
10:37:19 AM: at require (internal/modules/cjs/helpers.js:72:18)
10:37:19 AM: at Object.<anonymous> (/opt/build/repo/node_modules/@redwoodjs/cli/dist/commands/dataMigrate/up.js:49:5)
10:37:19 AM: at Module._compile (internal/modules/cjs/loader.js:1137:30)
10:37:19 AM: at Object.Module._extensions..js (internal/modules/cjs/loader.js:1157:10)
10:37:19 AM: at Module.load (internal/modules/cjs/loader.js:985:32)
10:37:19 AM: at Function.Module._load (internal/modules/cjs/loader.js:878:14)
10:37:19 AM: at Module.require (internal/modules/cjs/loader.js:1025:19) {
10:37:19 AM: code: 'MODULE_NOT_FOUND',
10:37:19 AM: requireStack: [
10:37:19 AM: '/opt/build/repo/node_modules/@redwoodjs/cli/dist/commands/dataMigrate/up.js',
10:37:19 AM: '/opt/build/repo/node_modules/yargs/index.js',
10:37:19 AM: '/opt/build/repo/node_modules/@redwoodjs/cli/dist/index.js'
10:37:19 AM: ]
10:37:19 AM: }
10:37:19 AM: error Command failed with exit code 1.
10:37:19 AM: info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
10:37:19 AM:
10:37:19 AM: ┌─────────────────────────────┐
10:37:19 AM: │ "build.command" failed │
10:37:19 AM: └─────────────────────────────┘
10:37:19 AM:
10:37:19 AM: Error message
10:37:19 AM: Command failed with exit code 1: yarn rw db up --no-db-client --auto-approve && yarn rw dataMigrate up && yarn rw build
10:37:19 AM:
10:37:19 AM: Error location
10:37:19 AM: In build.command from netlify.toml:
10:37:19 AM: yarn rw db up --no-db-client --auto-approve && yarn rw dataMigrate up && yarn rw build
10:37:19 AM:
10:37:19 AM: Resolved config
10:37:19 AM: build:
10:37:19 AM: command: yarn rw db up --no-db-client --auto-approve && yarn rw dataMigrate up && yarn rw build
10:37:19 AM: commandOrigin: config
10:37:19 AM: environment:
10:37:19 AM: - DATABASE_URL
10:37:19 AM: functions: /opt/build/repo/api/dist/functions
10:37:19 AM: publish: /opt/build/repo/web/dist
10:37:19 AM: plugins:
10:37:19 AM: - inputs: {}
10:37:19 AM: origin: config
10:37:19 AM: package: netlify-plugin-prisma-provider
10:37:19 AM: redirects:
10:37:19 AM: - from: /* status: 200 to: /index.htmlCaching artifacts
10:37:19 AM: Started saving node modules
10:37:19 AM: Finished saving node modules
10:37:19 AM: Started saving build plugins
10:37:19 AM: Finished saving build plugins
10:37:19 AM: Started saving yarn cache
10:37:19 AM: Finished saving yarn cache
10:37:19 AM: Started saving pip cache
10:37:19 AM: Finished saving pip cache
10:37:19 AM: Started saving emacs cask dependencies
10:37:19 AM: Finished saving emacs cask dependencies
10:37:19 AM: Started saving maven dependencies
10:37:19 AM: Finished saving maven dependencies
10:37:19 AM: Started saving boot dependencies
10:37:19 AM: Finished saving boot dependencies
10:37:19 AM: Started saving go dependencies
10:37:19 AM: Finished saving go dependencies
10:37:23 AM: Error running command: Build script returned non-zero exit code: 1
10:37:23 AM: Failing build: Failed to build site
10:37:23 AM: Failed during stage 'building site': Build script returned non-zero exit code: 1
10:37:23 AM: Finished processing build request in 2m0.392176707s
@cannikin Was this what you were working on yesterday?
@peterp No this is something different...I never saw Cannot find module '/opt/build/repo/api/src/lib/db'
@noire-munich Once you get past that error you will most likely see another—@prisma/client did not initialize yet. Please run "prisma generate" and try to import it again.
There are two things you need to do:
netlify.toml
remove the --no-db-client
flag from the build commandBINARY_TARGET
to native
@cannikin I actually edited out the yarn rw dataMigrate up
command since I'm not using it, the deploy then proceeded naturally as I did not encounter other bugs.
I have BINARY_TARGET=debian-openssl-1.1.x
which is running fine, should I replace it with native
anyway? are recommendations changing about this?
@noire-munich Could you try replacing it with "native"? I'm not sure who changed what (Netlify or Prisma) but it seems like manually setting the binaryTarget manually isn't required any longer...@thedavidprice and I both changed ours and deploys worked fine, we'd love to get a confirmation from someone other than us!
@cannikin argh, wish it was that simple.
I changed to native
on the demo project: deploy still doesn't work ( this one has dataMigrate
command in the build
command and a typescript db
file ).
Now I've changed to native
also on my main project and it's still running smoothly. I didn't have any update code to deploy - but if in my next deploys I have issues I'll report here.
Either way, seems safe to recommend changing to native
as you and @thedavidprice have, yet I still find an issue with dataMigrate
and a typescript db.ts
file. I'm not personally blocked, but anyone going .ts
on the project and needing the command will have the issue.
Have you been able to try it locally?
@noire-munich Okay I renamed db.js
to db.ts
and am getting the same error.
@peterp You can use my sample repo here: https://github.com/cannikin/prisma-native Try to run yarn rw dataMigrate up
to get the error.
@cannikin think this one can be closed?
haha probably
https://github.com/redwoodjs/redwood/blob/ffed13f62826b6b725c971bd0dcd6d346de6878d/packages/cli/src/commands/dataMigrate/up.js#L12
I tried a deploy right after the
v0.15.0
upgrade and the dataMigrate command did not work because it couldn't find the db module:10:40:43 AM: $ /opt/build/repo/node_modules/.bin/rw dataMigrate up 10:40:45 AM: /opt/build/repo/node_modules/yargs/build/lib/yargs.js:1132 10:40:45 AM: throw err; 10:40:45 AM: ^ 10:40:45 AM: Error: Cannot find module '/opt/build/repo/api/src/lib/db' 10:40:45 AM: Require stack: 10:40:45 AM: - /opt/build/repo/node_modules/@redwoodjs/cli/dist/commands/dataMigrate/up.js
The import of a
db.ts
doesn't work.I'm opening the issue in case I can't provide a fix myself :-.