Skip to content

Instantly share code, notes, and snippets.

@alsoamit
Created March 13, 2023 07:29
Show Gist options
  • Save alsoamit/5806cdef12fc22c6aab6dc983983b0c1 to your computer and use it in GitHub Desktop.
Save alsoamit/5806cdef12fc22c6aab6dc983983b0c1 to your computer and use it in GitHub Desktop.
Delete livestream using Mux SDK in aws Lambda Nodejs 18.x runtime
// Don't forget to include node_modules with "@mux/mux-node" installed in the Lambda
// Mux reads two environment variables MUX_TOKEN_ID and MUX_TOKEN_SECRET by default. Set them in the Lambda configuration.
import Mux from "@mux/mux-node";
const { Video, Data } = new Mux();
export const handler = async (event) => {
// Send id in the request body
// req.body = {id: <id-of-livestream-to-delete>}
const deletedLivestream = await Video.LiveStreams.del(event.id);
const response = {
statusCode: 200,
data: deletedLivestream
};
return response;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment