muxinc / cli Goto Github PK
View Code? Open in Web Editor NEWCommand Mux from the command line like a boss.
Command Mux from the command line like a boss.
I'm working with two different orgs and needing to switch the token credentials. I ran mux init
again and everything appeared to work, but then when I uploaded a new asset, it uploaded it to the previous account, not the one I just initialized.
mux init
returns credentials error while CURL is working fine
mux init
? What's your token ID? 1ec...
? What's your token secret? [hidden]
? Do you want to go ahead and set up a Signing Key? This is used to create tokens for signed playback policies. Yes
› Error: Couldn't create a signing key pair! Are you sure your token credentials were right?
CURL
curl --location 'https://api.mux.com/system/v1/signing-keys' \
-H 'Accept: application/json' \
-u ${MUX_TOKEN_ID}:${MUX_TOKEN_SECRET}
{"total_row_count":1,"data":[{"id":"whe123","created_at":"1683369357"}]}
Version
mux version
@mux/cli/0.8.0 darwin-arm64 node-v20.0.0
When running mux assets:upload
the URL that is returned 404's.
Just putting this here to prime interest. Seems like this would be a good fit in this pkg and could also help adoption as @mux/cli
would be a dependency for these Mux SSG components.
Idea is to create a mux assets:server
or mux assets:serve
command which would spin up a node http server on port 1352
(<= easter egg in there, 26-Number(mux))
This little local server would accept commands with data similar that mux create/upload accepts, primarily a remote video url or local video file path and create or upload these assets showing a nice little progress bar etc.
It would save the returned playback ids and input data in a JSON file locally similar to
{"data":{"https://muxed.s3.amazonaws.com/ink.mp4":{"assetId":"iGWOYSm8WqOwS01OR00qj71Wq3U00DaLaYY6i3ODkyCHn4","playbackId":"9YHhYABjohpd4m001qzFGf1TdOgLTB46ySlA7ThlFziA"}}}
This would be very useful for site builders like Next.js etc. to quickly request an upload from a UI component but don't hang the yarn dev
process. It being a decoupled process would also make it a lot easier to build lightweight components / plugins / tags for other builders like Astro, Eleventy, Hugo etc.
I'm creating it separately at the moment for https://github.com/muxinc/nextjs-components/blob/main/src/mux-assets-cli.ts
Thoughts? Good to add or best to create a separate package?
I did the following steps
~/.config/@mux/cli/config.json
(as expected) - see output belowmux sign -t video
TypeError: Signing Key ID required
For example:
❯ mux sign qIJBqaJPkhNXiHbed8j2jyx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RCW6ITisZEeZy4IifrTAsXQm0jwS2IkjMAGOVStm4Q8lwyZ_4UmhTUbZruadqKXcYnJP9bV-dHV-EcIRul6spbjVIw78kswRvmJ24pu93MOhhFeaQN6Wg9gc_dBHJo9meJk4E_LYTatPUxHZd5k5twxYnBHt7WtOtJ-BT3w
👉 Copied Full URL to your system clipboard
Notice that this type of signed URL is a thumbnail
, but the CLI is giving me a URL for stream.mux.com
-- it should be: https://image.mux.com/{playback_id}/thumbnail.jpg?token=xxxxx
For the example above, it should have generated:
https://image.mux.com/qIJBqaJPkhNXiHbed8j2jyx02tQQWBI5fL6WkIQYL63w/thumbnail.jpg?token=eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6ImFkamYzb2JpYURUcEF0QVlpS3NCMkpvRlkwMXBpbEJMTHdYcUQzaHpJYURJIn0.eyJleHAiOjE5NjE2NTkzOTQsImF1ZCI6InQiLCJzdWIiOiJxSUpCcWFKUGtoTlhpSGJlZDhqMmp5eDAydFFRV0JJNWZMNldrSVFZTDYzdyJ9.nzOv2MvH96ujApUL8trma91HrNb1eJjQNbDTYvcP2jJgrv_fsiEdwxvAjvwyo1ZNUgzdjvsVVezLdlt2rBsav7ZTPptZ4NR5a-e_L2ar3KUJWt0eRi-B52i1lzJ1CriEDkHgz7qGoIvdfIZdMwg6h-cuCEeQsyFR-v37X7pZt9YHThLRCW6ITisZEeZy4IifrTAsXQm0jwS2IkjMAGOVStm4Q8lwyZ_4UmhTUbZruadqKXcYnJP9bV-dHV-EcIRul6spbjVIw78kswRvmJ24pu93MOhhFeaQN6Wg9gc_dBHJo9meJk4E_LYTatPUxHZd5k5twxYnBHt7WtOtJ-BT3w
It seems that on the Windows platform, when you run the init
command for the first time, that there is a difference with how the ENOENT
is raised to the NodeJS runtime.
This is a problem because there is a check in the ./src/command-bases/base.ts
file that looks for -2
specifically to know if it needs to create a new config.json
or not.
master
branchyarn install
yarn build
./bin/run init
On the macOS platform, it comes through accompanied with a -2
errno
value—
[Error: ENOENT: no such file or directory, open '/Users/erik.pena/.config/@mux/cli/config.json'] {
errno: -2,
code: 'ENOENT',
syscall: 'open',
path: '/Users/erik.pena/.config/@mux/cli/config.json'
}
On the Windows platform, it comes through accompanied with a -4058
errno
value—
[Error: ENOENT: no such file or directory, open 'C:\Users\erikp\AppData\Local\@mux\cli\config.json'] {
errno: -4058,
code: 'ENOENT',
syscall: 'open',
path: 'C:\\Users\\erikp\\AppData\\Local\\@mux\\cli\\config.json'
}
I also tested on the Linux platform, it comes through accompanied with a -2
errno
(like macOS) value—
[Error: ENOENT: no such file or directory, open '/home/erikpena/.config/@mux/cli/config.json'] {
errno: -2,
code: 'ENOENT',
syscall: 'open',
path: '/home/erikpena/.config/@mux/cli/config.json'
}
Tried to find a way to quickly check out mux (beyond the demo on the website). Thought the cli might be a way.
Installed with npm globally, running mux init myenv.env
brings up this error:
Error: Cannot find module '/usr/local/lib/node_modules/@mux/cli/lib/commands/init'
Require stack:
- /usr/local/lib/node_modules/@mux/cli/node_modules/@oclif/config/lib/plugin.js
- /usr/local/lib/node_modules/@mux/cli/node_modules/@oclif/config/lib/config.js
- /usr/local/lib/node_modules/@mux/cli/node_modules/@oclif/config/lib/index.js
- /usr/local/lib/node_modules/@mux/cli/node_modules/@oclif/command/lib/command.js
- /usr/local/lib/node_modules/@mux/cli/node_modules/@oclif/command/lib/index.js
- /usr/local/lib/node_modules/@mux/cli/bin/run
Code: MODULE_NOT_FOUND
as I was just about to quickly checkout mux I am not diving into debugging this on my own, maybe you can resolve this issue on your side?
@mux/cli/0.6.0 darwin-x64 node-v12.19.0
(also tried with node 14, doesn't work)
Thanks in advance
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.