ClaytonFarr / sveltekit-netlify-stripe-fauna-example

SaaS boilerplate example with SvelteKit + Tailwind + Netlify Identity (GoTrue) + Stripe + Fauna.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Deploy Fails after following all the Implementation Steps

cmarabate opened this issue · comments

I followed all the steps with no issues at all until the 12th step which I am now stuck on because the deploy fails. I even tried adding NODE_VERSION environment variable to tell it to use the LTS version of node (16.15.1). But it made no difference. And all my other environment variables are set correctly. Did something change that broke this or is there something I am missing preventing it from working for me?

Here is my deploy log...

2:42:15 PM: Build ready to start
2:42:19 PM: build-image version: 72a309a113b53ef075815b129953617827965e48 (focal)
2:42:19 PM: build-image tag: v4.8.2
2:42:19 PM: buildbot version: 72ebfe61ef7a5152002962d9129cc52f5b1bb560
2:42:19 PM: Fetching cached dependencies
2:42:19 PM: Failed to fetch cache, continuing with build
2:42:19 PM: Starting to prepare the repo for build
2:42:20 PM: No cached dependencies found. Cloning fresh repo
2:42:20 PM: git clone https://github.com/cmarabate/sveltekit-netlify-stripe-fauna-example-master
2:42:20 PM: Preparing Git Reference refs/heads/master
2:42:21 PM: Parsing package.json dependencies
2:42:22 PM: Starting build script
2:42:22 PM: Installing dependencies
2:42:22 PM: Python version set to 2.7
2:42:22 PM: Attempting node version '14' from .nvmrc
2:42:22 PM: Downloading and installing node v14.19.3...
2:42:22 PM: Downloading https://nodejs.org/dist/v14.19.3/node-v14.19.3-linux-x64.tar.xz...
2:42:23 PM: Computing checksum with sha256sum
2:42:23 PM: Checksums matched!
2:42:25 PM: Now using node v14.19.3 (npm v6.14.17)
2:42:25 PM: Started restoring cached build plugins
2:42:25 PM: Finished restoring cached build plugins
2:42:25 PM: Attempting ruby version 2.7.2, read from environment
2:42:26 PM: Using ruby version 2.7.2
2:42:27 PM: Using PHP version 8.0
2:42:27 PM: Started restoring cached yarn cache
2:42:27 PM: Finished restoring cached yarn cache
2:42:27 PM: No yarn workspaces detected
2:42:27 PM: Started restoring cached node modules
2:42:27 PM: Finished restoring cached node modules
2:42:27 PM: Installing NPM modules using Yarn version 1.22.10
2:42:28 PM: yarn install v1.22.10
2:42:28 PM: warning package.json: No license field
2:42:28 PM: warning package-lock.json found. Your project contains lock files generated by tools other than Yarn. It is advised not to mix package managers in order to avoid resolution inconsistencies caused by unsynchronized lock files. To clear this warning, remove package-lock.json.
2:42:28 PM: warning sveltekit-netlify-stripe-fauna-example@0.0.1: No license field
2:42:28 PM: [1/4] Resolving packages...
2:42:28 PM: [2/4] Fetching packages...
2:42:37 PM: info esbuild-android-64@0.14.47: The platform "linux" is incompatible with this module.
2:42:37 PM: info "esbuild-android-64@0.14.47" is an optional dependency and failed compatibility check. Excluding it from installation.
2:42:37 PM: info esbuild-android-arm64@0.14.47: The platform "linux" is incompatible with this module.
2:42:37 PM: info "esbuild-android-arm64@0.14.47" is an optional dependency and failed compatibility check. Excluding it from installation.
2:42:37 PM: Creating deploy upload records
2:42:37 PM: info esbuild-android-arm64@0.14.47: The CPU architecture "x64" is incompatible with this module.
2:42:37 PM: info esbuild-darwin-64@0.14.47: The platform "linux" is incompatible with this module.
2:42:37 PM: info "esbuild-darwin-64@0.14.47" is an optional dependency and failed compatibility check. Excluding it from installation.
2:42:37 PM: info esbuild-darwin-arm64@0.14.47: The platform "linux" is incompatible with this module.
2:42:37 PM: info "esbuild-darwin-arm64@0.14.47" is an optional dependency and failed compatibility check. Excluding it from installation.
2:42:38 PM: Failed during stage 'building site': Build script returned non-zero exit code: 1 (https://ntl.fyi/exit-code-1)
2:42:37 PM: info esbuild-darwin-arm64@0.14.47: The CPU architecture "x64" is incompatible with this module.
2:42:37 PM: info esbuild-freebsd-64@0.14.47: The platform "linux" is incompatible with this module.
2:42:37 PM: info "esbuild-freebsd-64@0.14.47" is an optional dependency and failed compatibility check. Excluding it from installation.
2:42:37 PM: info esbuild-freebsd-arm64@0.14.47: The platform "linux" is incompatible with this module.
2:42:37 PM: info "esbuild-freebsd-arm64@0.14.47" is an optional dependency and failed compatibility check. Excluding it from installation.
2:42:37 PM: info esbuild-freebsd-arm64@0.14.47: The CPU architecture "x64" is incompatible with this module.
2:42:37 PM: info esbuild-linux-32@0.14.47: The CPU architecture "x64" is incompatible with this module.
2:42:37 PM: info "esbuild-linux-32@0.14.47" is an optional dependency and failed compatibility check. Excluding it from installation.
2:42:37 PM: info esbuild-linux-arm@0.14.47: The CPU architecture "x64" is incompatible with this module.
2:42:37 PM: info "esbuild-linux-arm@0.14.47" is an optional dependency and failed compatibility check. Excluding it from installation.
2:42:37 PM: info esbuild-linux-arm64@0.14.47: The CPU architecture "x64" is incompatible with this module.
2:42:37 PM: info "esbuild-linux-arm64@0.14.47" is an optional dependency and failed compatibility check. Excluding it from installation.
2:42:37 PM: info esbuild-linux-mips64le@0.14.47: The CPU architecture "x64" is incompatible with this module.
2:42:37 PM: info "esbuild-linux-mips64le@0.14.47" is an optional dependency and failed compatibility check. Excluding it from installation.
2:42:37 PM: info esbuild-linux-ppc64le@0.14.47: The CPU architecture "x64" is incompatible with this module.
2:42:37 PM: info "esbuild-linux-ppc64le@0.14.47" is an optional dependency and failed compatibility check. Excluding it from installation.
2:42:37 PM: info esbuild-linux-riscv64@0.14.47: The CPU architecture "x64" is incompatible with this module.
2:42:37 PM: info "esbuild-linux-riscv64@0.14.47" is an optional dependency and failed compatibility check. Excluding it from installation.
2:42:37 PM: info esbuild-linux-s390x@0.14.47: The CPU architecture "x64" is incompatible with this module.
2:42:37 PM: info "esbuild-linux-s390x@0.14.47" is an optional dependency and failed compatibility check. Excluding it from installation.
2:42:37 PM: info esbuild-netbsd-64@0.14.47: The platform "linux" is incompatible with this module.
2:42:37 PM: info "esbuild-netbsd-64@0.14.47" is an optional dependency and failed compatibility check. Excluding it from installation.
2:42:37 PM: info esbuild-openbsd-64@0.14.47: The platform "linux" is incompatible with this module.
2:42:37 PM: info "esbuild-openbsd-64@0.14.47" is an optional dependency and failed compatibility check. Excluding it from installation.
2:42:37 PM: info esbuild-sunos-64@0.14.47: The platform "linux" is incompatible with this module.
2:42:37 PM: info "esbuild-sunos-64@0.14.47" is an optional dependency and failed compatibility check. Excluding it from installation.
2:42:37 PM: info esbuild-windows-32@0.14.47: The platform "linux" is incompatible with this module.
2:42:37 PM: info "esbuild-windows-32@0.14.47" is an optional dependency and failed compatibility check. Excluding it from installation.
2:42:37 PM: info esbuild-windows-32@0.14.47: The CPU architecture "x64" is incompatible with this module.
2:42:37 PM: info esbuild-windows-64@0.14.47: The platform "linux" is incompatible with this module.
2:42:37 PM: info "esbuild-windows-64@0.14.47" is an optional dependency and failed compatibility check. Excluding it from installation.
2:42:37 PM: info esbuild-windows-arm64@0.14.47: The platform "linux" is incompatible with this module.
2:42:37 PM: info "esbuild-windows-arm64@0.14.47" is an optional dependency and failed compatibility check. Excluding it from installation.
2:42:37 PM: info esbuild-windows-arm64@0.14.47: The CPU architecture "x64" is incompatible with this module.
2:42:37 PM: error @sveltejs/kit@1.0.0-next.354: The engine "node" is incompatible with this module. Expected version ">=16.7". Got "14.19.3"
2:42:37 PM: error Found incompatible module.
2:42:37 PM: info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
2:42:37 PM: Error during Yarn install
2:42:37 PM: Build was terminated: Build script returned non-zero exit code: 1
2:42:37 PM: Failing build: Failed to build site
2:42:38 PM: Finished processing build request in 19.047244663s

Hi @cmarabate,

SvelteKit has undergone breaking changes since this repo was created as it's been advancing toward v1. The repo should work if you force SK to use the older version it used at the time (@sveltejs/kit 1.0.0-next.115). I'd definitely recommend using the most recent version of SvelteKit (@sveltejs/kit 1.0.0-next.355 at this writing) but you'll have updates required to get things working.

The first one showing up in your deploy log looks to be a mismatched dependency -

error @sveltejs/kit@1.0.0-next.354: The engine "node" is incompatible with this module. Expected version ">=16.7". Got "14.19.3"

This might be a result of the setting in the current .nvmrc file in the repo.

The quickest path may be create a new SvelteKit skeleton project, and then bring over the elements from this repo that you need - components, routes, utils, etc.

In the process of doing this you should see the differences in how things have been updated, in endpoints, hooks, etc. The SvelteKit CLI will also give feedback if there are breaking changes in any old markup or methods you may be copying over.

If you're more interested in just seeing this repo in action as it was originally authored, you should be able to update package.json to just use the older versions mentioned at the top of this section

Oh I see, thanks!

I tried updating package.json to use the versions you mentioned but it did not work and these are the strangest version numbers I have ever seen...
image

Did I do that right? Because the build still fails, just differently. Here is the important part of the deploy log...

1:01:10 PM: $ npm run build
1:01:10 PM: > sveltekit-netlify-stripe-fauna-example@0.0.1 build /opt/build/repo
1:01:10 PM: > run-s build-sk copy-functions copy-auth-email-templates
1:01:10 PM: > sveltekit-netlify-stripe-fauna-example@0.0.1 build-sk /opt/build/repo
1:01:10 PM: > svelte-kit build
1:01:11 PM: > Named export 'transformWithEsbuild' not found. The requested module 'vite' is a CommonJS module, which may not support all module.exports as named exports.
1:01:11 PM: CommonJS modules can always be imported via the default export, for example using:
1:01:11 PM: import pkg from 'vite';
1:01:11 PM: 
1:01:11 PM: file:///opt/build/repo/node_modules/@sveltejs/vite-plugin-svelte/dist/index.js:861
1:01:11 PM:   transformWithEsbuild
1:01:11 PM:   ^^^^^^^^^^^^^^^^^^^^
1:01:11 PM: SyntaxError: Named export 'transformWithEsbuild' not found. The requested module 'vite' is a CommonJS module, which may not support all module.exports as named exports.
1:01:11 PM: CommonJS modules can always be imported via the default export, for example using:
1:01:11 PM: import pkg from 'vite';
1:01:11 PM:     at ModuleJob._instantiate (internal/modules/esm/module_job.js:124:21)
1:01:11 PM:     at async ModuleJob.run (internal/modules/esm/module_job.js:179:5)
1:01:11 PM:     at async Loader.import (internal/modules/esm/loader.js:178:24)
1:01:11 PM:     at async file:///opt/build/repo/node_modules/@sveltejs/kit/dist/cli.js:647:22
1:01:11 PM: npm ERR! code ELIFECYCLE
1:01:11 PM: npm ERR! errno 1
1:01:11 PM: npm ERR! sveltekit-netlify-stripe-fauna-example@0.0.1 build-sk: `svelte-kit build`
1:01:11 PM: npm ERR! Exit status 1
1:01:11 PM: npm ERR!
1:01:11 PM: npm ERR! Failed at the sveltekit-netlify-stripe-fauna-example@0.0.1 build-sk script.
1:01:11 PM: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
1:01:11 PM: npm ERR! A complete log of this run can be found in:
1:01:11 PM: npm ERR!     /opt/buildhome/.npm/_logs/2022-06-28T17_01_11_103Z-debug.log
1:01:11 PM: ERROR: "build-sk" exited with 1.
1:01:11 PM: npm ERR! code ELIFECYCLE
1:01:11 PM: npm ERR! errno 1
1:01:11 PM: npm ERR! sveltekit-netlify-stripe-fauna-example@0.0.1 build: `run-s build-sk copy-functions copy-auth-email-templates`
1:01:11 PM: npm ERR! Exit status 1
1:01:11 PM: npm ERR!
1:01:11 PM: npm ERR! Failed at the sveltekit-netlify-stripe-fauna-example@0.0.1 build script.
1:01:11 PM: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
1:01:11 PM: npm ERR! A complete log of this run can be found in:
1:01:11 PM: npm ERR!     /opt/buildhome/.npm/_logs/2022-06-28T17_01_11_146Z-debug.log
1:01:11 PM: ​
1:01:11 PM: ────────────────────────────────────────────────────────────────
1:01:11 PM:   "build.command" failed                                        
1:01:11 PM: ────────────────────────────────────────────────────────────────
1:01:11 PM: ​
1:01:11 PM:   Error message
1:01:11 PM:   Command failed with exit code 1: npm run build (https://ntl.fyi/exit-code-1)
1:01:11 PM: ​
1:01:11 PM:   Error location
1:01:11 PM:   In build.command from netlify.toml:
1:01:11 PM:   npm run build
1:01:11 PM: ​
1:01:11 PM:   Resolved config
1:01:11 PM:   build:
1:01:11 PM:     command: npm run build
1:01:11 PM:     commandOrigin: config
1:01:11 PM:     environment:
1:01:11 PM:       - FAUNADB_ADMIN_SECRET
1:01:11 PM:       - FAUNADB_CLIENT_SECRET
1:01:11 PM:       - FAUNADB_SERVER_SECRET
1:01:11 PM:       - FAUNA_SERVER_KEY
1:01:11 PM:       - NODE_VERSION
1:01:11 PM:       - STRIPE_DEFAULT_PRICE_PLAN
1:01:11 PM:       - STRIPE_SECRET_KEY
1:01:11 PM:       - STRIPE_UPDATES_WEBHOOK_SECRET
1:01:11 PM:     publish: /opt/build/repo/build
1:01:11 PM:     publishOrigin: config
1:01:11 PM:   functionsDirectory: /opt/build/repo/functions

I would try what you suggested about creating a new SvelteKit skeleton project but this is my first experience with SvelteKit. So I don't really know what I am doing. Do you have any plans on updating this repo like you suggested so that it will work with the latest version of SvelteKit? Or do you happen to know of any other repos that accomplish the same thing using Netlify Identity, Netlify Functions, Stripe Subscriptions, and Fauna as the database that links Netlify Identity Users with Stripe Customers? I do not care if it is SvelteKit or not, I just need it to be a React site.

Thanks again!

@cmarabate I may update this repo later when time affords - but don't know yet when that will be.

Unfortunately I don't know of any other, more recent examples with this same stack to point you toward.

But, working with SvelteKit vs. React is usually an either-or choice.

If you know you want to work with React it may be worth skipping this example and searching specifically for examples that use a mix of React plus one or more of GoTrue (Netlify Identity), Stripe, or Fauna.

The API calls and utilities used for those services within this repo may be helpful, but the SK code/ui would be less so.