openziti / ziti-sdk-nodejs

An SDK for embedding zero trust into Node.JS applications and web servers to improve security.
Apache License 2.0
74 stars 3 forks source link

Forbidden error on MacOS Node 16 #62

Closed cyberiums closed 1 year ago

cyberiums commented 1 year ago

Hi,

I tried installing Node SDK. It seems some repos are not available or have moved. https://ziti-npm.s3.amazonaws.com/ziti_sdk_nodejs/v0.13.3/Release/ziti_sdk_nodejs-v0.13.3-node-v93-darwin-arm64.tar.gz

`

npm ERR! code 1 npm ERR! path /Users/user/app/ziti/node_modules/@openziti/ziti-sdk-nodejs npm ERR! command failed npm ERR! command sh -c -- node-pre-gyp install --fallback-to-build npm ERR! Failed to execute '/Users/user/.nvm/versions/node/v16.17.0/bin/node /Users/user/.nvm/versions/node/v16.17.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --module=/Users/user/app/ziti/node_modules/@openziti/ziti-sdk-nodejs/build/Release/node-v93-darwin-arm64/ziti_sdk_nodejs.node --module_name=ziti_sdk_nodejs --module_path=/Users/user/app/ziti/node_modules/@openziti/ziti-sdk-nodejs/build/Release/node-v93-darwin-arm64 --napi_version=8 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v93 --python=/opt/homebrew/bin/python3' (1) npm ERR! node-pre-gyp info it worked if it ends with ok npm ERR! node-pre-gyp info using node-pre-gyp@1.0.11 npm ERR! node-pre-gyp info using node@16.17.0 | darwin | arm64 npm ERR! node-pre-gyp info check checked for "/Users/user/app/ziti/node_modules/@openziti/ziti-sdk-nodejs/build/Release/node-v93-darwin-arm64/ziti_sdk_nodejs.node" (not found) npm ERR! node-pre-gyp http GET https://ziti-npm.s3.amazonaws.com/ziti_sdk_nodejs/v0.13.3/Release/ziti_sdk_nodejs-v0.13.3-node-v93-darwin-arm64.tar.gz npm ERR! node-pre-gyp ERR! install response status 403 Forbidden on https://ziti-npm.s3.amazonaws.com/ziti_sdk_nodejs/v0.13.3/Release/ziti_sdk_nodejs-v0.13.3-node-v93-darwin-arm64.tar.gz npm ERR! node-pre-gyp WARN Pre-built binaries not installable for @openziti/ziti-sdk-nodejs@0.13.3 and node@16.17.0 (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://ziti-npm.s3.amazonaws.com/ziti_sdk_nodejs/v0.13.3/Release/ziti_sdk_nodejs-v0.13.3-node-v93-darwin-arm64.tar.gz npm ERR! gyp info it worked if it ends with ok npm ERR! gyp info using node-gyp@9.1.0 npm ERR! gyp info using node@16.17.0 | darwin | arm64 npm ERR! gyp info ok npm ERR! gyp info it worked if it ends with ok npm ERR! gyp info using node-gyp@9.1.0 npm ERR! gyp info using node@16.17.0 | darwin | arm64 npm ERR! gyp info find Python using Python version 3.11.4 found at "/opt/homebrew/opt/python@3.11/bin/python3.11" npm ERR! gyp info spawn /opt/homebrew/opt/python@3.11/bin/python3.11 npm ERR! gyp info spawn args [ npm ERR! gyp info spawn args '/Users/user/.nvm/versions/node/v16.17.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 '/Users/user/app/ziti/node_modules/@openziti/ziti-sdk-nodejs/build/config.gypi', npm ERR! gyp info spawn args '-I', npm ERR! gyp info spawn args '/Users/user/.nvm/versions/node/v16.17.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/user/Library/Caches/node-gyp/16.17.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/user/Library/Caches/node-gyp/16.17.0', npm ERR! gyp info spawn args '-Dnode_gyp_dir=/Users/user/.nvm/versions/node/v16.17.0/lib/node_modules/npm/node_modules/node-gyp', npm ERR! gyp info spawn args '-Dnode_lib_file=/Users/user/Library/Caches/node-gyp/16.17.0/<(target_arch)/node.lib', npm ERR! gyp info spawn args '-Dmodule_root_dir=/Users/user/app/ziti/node_modules/@openziti/ziti-sdk-nodejs', 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! fatal: not a git repository (or any of the parent directories): .git npm ERR! gyp: Call to 'git branch --show-current' returned exit status 128 while in binding.gyp. while trying to load binding.gyp npm ERR! gyp ERR! configure error npm ERR! gyp ERR! stack Error: gyp failed with exit code: 1 npm ERR! gyp ERR! stack at ChildProcess.onCpExit (/Users/user/.nvm/versions/node/v16.17.0/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:284:16) npm ERR! gyp ERR! stack at ChildProcess.emit (node:events:513:28) npm ERR! gyp ERR! stack at Process.ChildProcess._handle.onexit (node:internal/child_process:291:12) npm ERR! gyp ERR! System Darwin 22.5.0 npm ERR! gyp ERR! command "/Users/user/.nvm/versions/node/v16.17.0/bin/node" "/Users/user/.nvm/versions/node/v16.17.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "configure" "--fallback-to-build" "--module=/Users/user/app/ziti/node_modules/@openziti/ziti-sdk-nodejs/build/Release/node-v93-darwin-arm64/ziti_sdk_nodejs.node" "--module_name=ziti_sdk_nodejs" "--module_path=/Users/user/app/ziti/node_modules/@openziti/ziti-sdk-nodejs/build/Release/node-v93-darwin-arm64" "--napi_version=8" "--node_abi_napi=napi" "--napi_build_version=0" "--node_napi_label=node-v93" "--python=/opt/homebrew/bin/python3" npm ERR! gyp ERR! cwd /Users/user/app/ziti/node_modules/@openziti/ziti-sdk-nodejs npm ERR! gyp ERR! node -v v16.17.0 npm ERR! gyp ERR! node-gyp -v v9.1.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/user/.nvm/versions/node/v16.17.0/bin/node /Users/user/.nvm/versions/node/v16.17.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --module=/Users/user/app/ziti/node_modules/@openziti/ziti-sdk-nodejs/build/Release/node-v93-darwin-arm64/ziti_sdk_nodejs.node --module_name=ziti_sdk_nodejs --module_path=/Users/user/app/ziti/node_modules/@openziti/ziti-sdk-nodejs/build/Release/node-v93-darwin-arm64 --napi_version=8 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v93 --python=/opt/homebrew/bin/python3' (1) npm ERR! node-pre-gyp ERR! stack at ChildProcess. (/Users/user/app/ziti/node_modules/@mapbox/node-pre-gyp/lib/util/compile.js:89:23) npm ERR! node-pre-gyp ERR! stack at ChildProcess.emit (node:events:513:28) npm ERR! node-pre-gyp ERR! stack at maybeClose (node:internal/child_process:1093:16) npm ERR! node-pre-gyp ERR! stack at Process.ChildProcess._handle.onexit (node:internal/child_process:302:5) npm ERR! node-pre-gyp ERR! System Darwin 22.5.0 npm ERR! node-pre-gyp ERR! command "/Users/user/.nvm/versions/node/v16.17.0/bin/node" "/Users/user/app/ziti/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build" npm ERR! node-pre-gyp ERR! cwd /Users/user/app/ziti/node_modules/@openziti/ziti-sdk-nodejs npm ERR! node-pre-gyp ERR! node -v v16.17.0 npm ERR! node-pre-gyp ERR! node-pre-gyp -v v1.0.11 npm ERR! node-pre-gyp ERR! not ok

npm ERR! A complete log of this run can be found in: npm ERR! /Users/user/.npm/_logs/2023-08-09T02_33_53_137Z-debug-0.log

`

andrescv commented 1 year ago

Just checked and it seems that the issue is caused by the GitHub workflow:

https://github.com/openziti/ziti-sdk-nodejs/actions/runs/6024867141/job/16344433907

If you check the Publish Binary to S3 step of the above link, it should publish the binary to:

https://ziti-npm.s3.amazonaws.com/ziti_sdk_nodejs/v0.13.3/Release/ziti_sdk_nodejs-v0.13.3-node-v108-darwin-arm64.tar.gz

But instead is publishing it to:

https://ziti-npm.s3.amazonaws.com/ziti_sdk_nodejs/v0.13.3/Release/ziti_sdk_nodejs-v0.13.3-node-v108-darwin-x64.tar.gz

The reason is that you currently can’t specify the runner architecture (defaults to x64), unless you stablish a self-hosted runner to build the binary for macOS arm64

marvkis commented 1 year ago

I Just also ran into this. Does this mean it won't work for arm64 Mac's?

rentallect commented 1 year ago

We are currently in the middle of efforts related to releasing the next version of the NodeJS SDK. Once that becomes available, installs of the SDK should start working on arm64 Macs. I'll ping you back here once the new release is available.

rentallect commented 1 year ago

We have released version 0.14.1 of this SDK, which has arm64 support for Macs on Node 16, 18, 19, and 20. You should now be able to npm i or yarn add from your Mac. I will now close this issue. Please reopen if you experience any trouble.

arpitBhalla commented 4 months ago

Hey @rentallect I got this error

 but is an incompatible architecture (have 'arm64', need 'x86_64h' or 'x86_64'))
rentallect commented 3 months ago

@arpitBhalla What NodeJS version, OS, and CPU architecture were you using when encountering your error?