Skip to content
This repository has been archived by the owner on Jan 18, 2024. It is now read-only.

Upgrade directus in all examples #99

Merged
merged 19 commits into from
Jun 8, 2022
Merged

Upgrade directus in all examples #99

merged 19 commits into from
Jun 8, 2022

Conversation

avioli
Copy link
Contributor

@avioli avioli commented May 19, 2022

I've upgraded directus across the board to 9.10.0 in all the examples and enabled CORS which uses CORS=true to match the Origin header.

Some examples like nuxt use an indirect package - nuxt-directus, which I upgraded to their latest versions as well.

Copy link
Contributor

@azrikahar azrikahar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

First of all, thank you very much for the upgrades across the board!

Quick question, was this verified with the current directus example? Since the database is still technically on 9.5.0 if I recall correctly as it has yet to run through any migrations since then. Haven't really got the chance to test this out locally, so once again thanks for the much needed maintenance. 👍

blitz/package.json Show resolved Hide resolved
nuxt3/nuxt3-directus-blog/nuxt.config.ts Outdated Show resolved Hide resolved
Copy link
Member

@Intevel Intevel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wouldn't update the Nuxt 3 like that, it's from a guide. We have to update the guide then too.

nuxt3/nuxt3-directus-blog/package.json Outdated Show resolved Hide resolved
nuxt3/nuxt3-directus-blog/pages/index.vue Outdated Show resolved Hide resolved
@avioli
Copy link
Contributor Author

avioli commented May 23, 2022

Quick question, was this verified with the current directus example?

@azrikahar Where is the current directus example? Is it https://github.com/directus/guides

I simply saw this repo in the org, cloned it on my M1 and nothing worked, so I got to fix it. When it turned out it is not a huge change-set I decided to fork and send a PR.

@azrikahar
Copy link
Contributor

@azrikahar Where is the current directus example? Is it https://github.com/directus/guides

I simply saw this repo in the org, cloned it on my M1 and nothing worked, so I got to fix it. When it turned out it is not a huge change-set I decided to fork and send a PR.

It is in this repo, /directus directory/folder (link). Just to clarify, when you say "nothing worked", did you run this directus example first before trying out the other examples (except nuxt3)? It should be described as a prerequisite in all of their README files, but do let us know if it isn't.

@avioli
Copy link
Contributor Author

avioli commented May 23, 2022

Just to clarify, when you say "nothing worked", did you run this directus example first before trying out the other examples (except nuxt3)?

Ah.. I see - I did run the directus example first, but the npm install command failed on my M1 Macbook, since it was trying to compile some node-gyp native binary, so I upgraded to latest directus and npm install-ed again, which completed successfully.

`npm install` output
/private/tmp/examples/directus> npm i
npm WARN deprecated @types/[email protected]: This is a stub types definition. pino provides its own type definitions, so you do not need this installed.
npm WARN deprecated @types/[email protected]: This is a stub types definition. cssnano provides its own type definitions, so you do not need this installed.
npm WARN deprecated [email protected]: this library is no longer supported
npm WARN deprecated [email protected]: The querystring API is considered Legacy. new code should use the URLSearchParams API instead.
npm WARN deprecated [email protected]: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.
npm WARN deprecated [email protected]: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.
npm WARN deprecated [email protected]: request has been deprecated, see https://github.com/request/request/issues/3142
npm WARN deprecated [email protected]: Please upgrade to @mapbox/node-pre-gyp: the non-scoped node-pre-gyp package is deprecated and only the @mapbox scoped package will recieve updates in the future
npm WARN deprecated [email protected]: This version of tar is no longer supported, and will not receive security updates. Please upgrade asap.
npm ERR! code 1
npm ERR! path /private/tmp/examples/directus/node_modules/sqlite3
npm ERR! command failed
npm ERR! command sh -c node-pre-gyp install --fallback-to-build
npm ERR! CC(target) Release/obj.target/nothing/node_modules/node-addon-api/nothing.o
npm ERR!   LIBTOOL-STATIC Release/nothing.a
npm ERR!   ACTION deps_sqlite3_gyp_action_before_build_target_unpack_sqlite_dep Release/obj/gen/sqlite-autoconf-3340000/sqlite3.c
npm ERR! Failed to execute '/Users/avioli/.nodenv/versions/16.13.0/bin/node /Users/avioli/.nodenv/versions/16.13.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --module=/private/tmp/examples/directus/node_modules/sqlite3/lib/binding/napi-v3-darwin-arm64/node_sqlite3.node --module_name=node_sqlite3 --module_path=/private/tmp/examples/directus/node_modules/sqlite3/lib/binding/napi-v3-darwin-arm64 --napi_version=8 --node_abi_napi=napi --napi_build_version=3 --node_napi_label=napi-v3' (1)
npm ERR! node-pre-gyp info it worked if it ends with ok
npm ERR! node-pre-gyp info using [email protected]
npm ERR! node-pre-gyp info using [email protected] | darwin | arm64
npm ERR! node-pre-gyp info check checked for "/private/tmp/examples/directus/node_modules/sqlite3/lib/binding/napi-v3-darwin-arm64/node_sqlite3.node" (not found)
npm ERR! node-pre-gyp http GET https://mapbox-node-binary.s3.amazonaws.com/sqlite3/v5.0.2/napi-v3-darwin-arm64.tar.gz
npm ERR! node-pre-gyp ERR! install response status 403 Forbidden on https://mapbox-node-binary.s3.amazonaws.com/sqlite3/v5.0.2/napi-v3-darwin-arm64.tar.gz 
npm ERR! node-pre-gyp WARN Pre-built binaries not installable for [email protected] and [email protected] (node-v93 ABI, unknown) (falling back to source compile with node-gyp) 
npm ERR! node-pre-gyp WARN Hit error response status 403 Forbidden on https://mapbox-node-binary.s3.amazonaws.com/sqlite3/v5.0.2/napi-v3-darwin-arm64.tar.gz 
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using [email protected]
npm ERR! gyp info using [email protected] | darwin | arm64
npm ERR! gyp info ok 
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using [email protected]
npm ERR! gyp info using [email protected] | darwin | arm64
npm ERR! gyp info find Python using Python version 3.9.13 found at "/opt/homebrew/opt/[email protected]/bin/python3.9"
npm ERR! gyp info spawn /opt/homebrew/opt/[email protected]/bin/python3.9
npm ERR! gyp info spawn args [
npm ERR! gyp info spawn args   '/Users/avioli/.nodenv/versions/16.13.0/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py',
npm ERR! gyp info spawn args   'binding.gyp',
npm ERR! gyp info spawn args   '-f',
npm ERR! gyp info spawn args   'make',
npm ERR! gyp info spawn args   '-I',
npm ERR! gyp info spawn args   '/private/tmp/examples/directus/node_modules/sqlite3/build/config.gypi',
npm ERR! gyp info spawn args   '-I',
npm ERR! gyp info spawn args   '/Users/avioli/.nodenv/versions/16.13.0/lib/node_modules/npm/node_modules/node-gyp/addon.gypi',
npm ERR! gyp info spawn args   '-I',
npm ERR! gyp info spawn args   '/Users/avioli/Library/Caches/node-gyp/16.13.0/include/node/common.gypi',
npm ERR! gyp info spawn args   '-Dlibrary=shared_library',
npm ERR! gyp info spawn args   '-Dvisibility=default',
npm ERR! gyp info spawn args   '-Dnode_root_dir=/Users/avioli/Library/Caches/node-gyp/16.13.0',
npm ERR! gyp info spawn args   '-Dnode_gyp_dir=/Users/avioli/.nodenv/versions/16.13.0/lib/node_modules/npm/node_modules/node-gyp',
npm ERR! gyp info spawn args   '-Dnode_lib_file=/Users/avioli/Library/Caches/node-gyp/16.13.0/<(target_arch)/node.lib',
npm ERR! gyp info spawn args   '-Dmodule_root_dir=/private/tmp/examples/directus/node_modules/sqlite3',
npm ERR! gyp info spawn args   '-Dnode_engine=v8',
npm ERR! gyp info spawn args   '--depth=.',
npm ERR! gyp info spawn args   '--no-parallel',
npm ERR! gyp info spawn args   '--generator-output',
npm ERR! gyp info spawn args   'build',
npm ERR! gyp info spawn args   '-Goutput_dir=.'
npm ERR! gyp info spawn args ]
npm ERR! gyp info ok 
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using [email protected]
npm ERR! gyp info using [email protected] | darwin | arm64
npm ERR! gyp info spawn make
npm ERR! gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
npm ERR! warning: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool: archive library: Release/nothing.a the table of contents is empty (no object file members in the library define global symbols)
npm ERR! /bin/sh: python: command not found
npm ERR! make: *** [Release/obj/gen/sqlite-autoconf-3340000/sqlite3.c] Error 127
npm ERR! gyp ERR! build error 
npm ERR! gyp ERR! stack Error: `make` failed with exit code: 2
npm ERR! gyp ERR! stack     at ChildProcess.onExit (/Users/avioli/.nodenv/versions/16.13.0/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:194:23)
npm ERR! gyp ERR! stack     at ChildProcess.emit (node:events:390:28)
npm ERR! gyp ERR! stack     at Process.ChildProcess._handle.onexit (node:internal/child_process:290:12)
npm ERR! gyp ERR! System Darwin 21.4.0
npm ERR! gyp ERR! command "/Users/avioli/.nodenv/versions/16.13.0/bin/node" "/Users/avioli/.nodenv/versions/16.13.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "build" "--fallback-to-build" "--module=/private/tmp/examples/directus/node_modules/sqlite3/lib/binding/napi-v3-darwin-arm64/node_sqlite3.node" "--module_name=node_sqlite3" "--module_path=/private/tmp/examples/directus/node_modules/sqlite3/lib/binding/napi-v3-darwin-arm64" "--napi_version=8" "--node_abi_napi=napi" "--napi_build_version=3" "--node_napi_label=napi-v3"
npm ERR! gyp ERR! cwd /private/tmp/examples/directus/node_modules/sqlite3
npm ERR! gyp ERR! node -v v16.13.0
npm ERR! gyp ERR! node-gyp -v v8.2.0
npm ERR! gyp ERR! not ok 
npm ERR! node-pre-gyp ERR! build error 
npm ERR! node-pre-gyp ERR! stack Error: Failed to execute '/Users/avioli/.nodenv/versions/16.13.0/bin/node /Users/avioli/.nodenv/versions/16.13.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --module=/private/tmp/examples/directus/node_modules/sqlite3/lib/binding/napi-v3-darwin-arm64/node_sqlite3.node --module_name=node_sqlite3 --module_path=/private/tmp/examples/directus/node_modules/sqlite3/lib/binding/napi-v3-darwin-arm64 --napi_version=8 --node_abi_napi=napi --napi_build_version=3 --node_napi_label=napi-v3' (1)
npm ERR! node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (/private/tmp/examples/directus/node_modules/@mapbox/node-pre-gyp/lib/util/compile.js:89:23)
npm ERR! node-pre-gyp ERR! stack     at ChildProcess.emit (node:events:390:28)
npm ERR! node-pre-gyp ERR! stack     at maybeClose (node:internal/child_process:1064:16)
npm ERR! node-pre-gyp ERR! stack     at Process.ChildProcess._handle.onexit (node:internal/child_process:301:5)
npm ERR! node-pre-gyp ERR! System Darwin 21.4.0
npm ERR! node-pre-gyp ERR! command "/Users/avioli/.nodenv/versions/16.13.0/bin/node" "/private/tmp/examples/directus/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build"
npm ERR! node-pre-gyp ERR! cwd /private/tmp/examples/directus/node_modules/sqlite3
npm ERR! node-pre-gyp ERR! node -v v16.13.0
npm ERR! node-pre-gyp ERR! node-pre-gyp -v v1.0.8
npm ERR! node-pre-gyp ERR! not ok

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/avioli/.npm/_logs/2022-05-23T02_23_49_912Z-debug.log
Exception: npm exited with 1
[tty 6], line 1: npm i

My guess is that the combination of explicit directus dependency of "9.7.0" and lax sqlite "^5.0.2" is the issue.

@azrikahar
Copy link
Contributor

Hmm judging from the error message: Pre-built binaries not installable for [email protected] and [email protected], I believe this is technically an issue with sqlite3, though I do wonder why is it looking for 5.0.2 when the notation is ^5.0.2 instead.. Likely very similar issue to TryGhost/node-sqlite3#1538, where the most recent reply is indeed asking to use a later version.

When you updated all these examples to 9.10.0, it's resolved due to directus/directus#13051, where we upgraded Knex to v2 and consequently set sqlite3 to at least 5.0.6, which should be the reason why it worked for you. So yeah, more of a sqlite3 thing rather than directus tbh, but the examples are still due for an upgrade nonetheless so all good.

@avioli
Copy link
Contributor Author

avioli commented May 24, 2022

Refactored nuxt3 upgrade into #100, but reverted all other changes so the guide doesn't have to change.

@Intevel Intevel dismissed their stale review May 24, 2022 05:41

Refactored in other PR

@azrikahar azrikahar self-assigned this May 27, 2022
@azrikahar azrikahar merged commit d5e7124 into directus-labs:main Jun 8, 2022
@azrikahar
Copy link
Contributor

Thanks again @avioli!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants