Huddly / sdk

Huddly's Software Development Kit (SDK) used to interact with the camera by third-party applications
MIT License
14 stars 8 forks source link

fix: Remove protobuf related dependencies #541

Closed brikendr closed 2 years ago

brikendr commented 2 years ago

The following dependencies are not required in sdk:

They are primarily used for generating javascript or typescript code from protocol buffer files.

Attempted to fix https://github.com/Huddly/sdk/issues/540 but the problem lies deep in the dependency tree! The fix would be for the maintainers of grpc-tools to create binaries for darwin-arm64 architecture.

brikendr commented 2 years ago

@RostiMelk can you try installing this sdk branch on an npm project. It should be a git dependency like so:

....
"@huddly/sdk": "git+ssh://git@github.com/Huddly/sdk.git#fix-issue-540",
....
RostiMelk commented 2 years ago

@brikendr Still getting errors unfortunately. Clean project, no package-lock.json. Node v16.6.0

npm i
npm ERR! code 1
npm ERR! git dep preparation failed
npm ERR! command /Users/rostimelk/.nvm/versions/node/v16.6.0/bin/node /Users/rostimelk/.nvm/versions/node/v16.6.0/lib/node_modules/npm/bin/npm-cli.js install --force --cache=/Users/rostimelk/.npm --prefer-offline=false --prefer-online=false --offline=false --no-progress --no-save --no-audit
npm ERR! npm WARN using --force Recommended protections disabled.
npm ERR! npm WARN deprecated uuid@3.4.0: 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 ERR! npm ERR! code 1
npm ERR! npm ERR! path /Users/rostimelk/.npm/_cacache/tmp/git-clone-16e9511c/node_modules/grpc-tools
npm ERR! npm ERR! command failed
npm ERR! npm ERR! command sh -c node-pre-gyp install
npm ERR! npm ERR! response status 404 Not Found on https://node-precompiled-binaries.grpc.io/grpc-tools/v1.11.2/darwin-arm64.tar.gz
npm ERR! npm ERR! node-pre-gyp info it worked if it ends with ok
npm ERR! npm ERR! node-pre-gyp info using node-pre-gyp@1.0.6
npm ERR! npm ERR! node-pre-gyp info using node@16.6.0 | darwin | arm64
npm ERR! npm ERR! node-pre-gyp info check checked for "/Users/rostimelk/.npm/_cacache/tmp/git-clone-16e9511c/node_modules/grpc-tools/bin/grpc_tools.node" (not found)
npm ERR! npm ERR! node-pre-gyp http GET https://node-precompiled-binaries.grpc.io/grpc-tools/v1.11.2/darwin-arm64.tar.gz
npm ERR! npm ERR! node-pre-gyp ERR! install response status 404 Not Found on https://node-precompiled-binaries.grpc.io/grpc-tools/v1.11.2/darwin-arm64.tar.gz
npm ERR! npm ERR! node-pre-gyp ERR! install error
npm ERR! npm ERR! node-pre-gyp ERR! stack Error: response status 404 Not Found on https://node-precompiled-binaries.grpc.io/grpc-tools/v1.11.2/darwin-arm64.tar.gz
npm ERR! npm ERR! node-pre-gyp ERR! stack     at /Users/rostimelk/.npm/_cacache/tmp/git-clone-16e9511c/node_modules/@mapbox/node-pre-gyp/lib/install.js:67:15
npm ERR! npm ERR! node-pre-gyp ERR! stack     at processTicksAndRejections (node:internal/process/task_queues:96:5)
npm ERR! npm ERR! node-pre-gyp ERR! System Darwin 21.2.0
npm ERR! npm ERR! node-pre-gyp ERR! command "/Users/rostimelk/.nvm/versions/node/v16.6.0/bin/node" "/Users/rostimelk/.npm/_cacache/tmp/git-clone-16e9511c/node_modules/.bin/node-pre-gyp" "install"
npm ERR! npm ERR! node-pre-gyp ERR! cwd /Users/rostimelk/.npm/_cacache/tmp/git-clone-16e9511c/node_modules/grpc-tools
npm ERR! npm ERR! node-pre-gyp ERR! node -v v16.6.0
npm ERR! npm ERR! node-pre-gyp ERR! node-pre-gyp -v v1.0.6
npm ERR! npm ERR! node-pre-gyp ERR! not ok
npm ERR!
npm ERR! npm ERR! A complete log of this run can be found in:
npm ERR! npm ERR!     /Users/rostimelk/.npm/_logs/2022-04-19T08_23_05_198Z-debug.log

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/rostimelk/.npm/_logs/2022-04-19T08_23_05_484Z-debug.log
brikendr commented 2 years ago

@RostiMelk can you post the contents of you package.json file?

RostiMelk commented 2 years ago

@RostiMelk can you post the contents of you package.json file?

@brikendr Here you go :))

{
    "name": "issue-540",
    "version": "1.0.0",
    "description": "",
    "main": "index.js",
    "scripts": {
        "start": "node index.js"
    },
    "dependencies": {
        "@huddly/sdk": "git+ssh://git@github.com/Huddly/sdk.git#fix-issue-540"
    },
    "keywords": [],
    "author": "",
    "license": "ISC"
}
brikendr commented 2 years ago

Thank you @RostiMelk. It seems like the issue is with one of the sub dependencies of the sdk. From the error log we see that npm fails to find grpc-tools@v1.11.2 for darwin-arm64 architecture. This dependency is part of the @huddly/camera-proto and @huddly/camera-switch-proto dependencies. Unfortunately just removing the stale dev-dependencies here does not seem to do the trick. However, removing these dependencies is still a valid PR but it does not fix the issue at hand.