'channel permissions overwrites not working despite bot saying it works, discord.js

I am creating a slash command to overwrite permissions on a private text channel so that when the command is called, a channel and role is specified by the user and that role is the only one that will be able to see that channel. I am using the permission overwrite manager to accomplish this but when the command is run, it will say it worked but when I actually check the channel, nothing has changed. My code for this command is below. What am I doing wrong?

const { Permissions } = require('discord.js');

module.exports = {
    data: new SlashCommandBuilder()
    .setName('givechannel')
    .setDescription('Give an existing role to a channel')
    .addChannelOption((option) => 
        option
        .setName('target')
        .setDescription('Channel to give the role to')
    )
    .addRoleOption(option => 
        option
        .setName('role')
        .setDescription('role to give the channel')
    ),

    async execute(interaction) {
        const channel = interaction.options.getChannel("target");
        const role = interaction.options.getRole("role");
        const name = interaction.guild.channels.cache.get(channel.id);
        const id = interaction.guild.roles.cache.get(role.id);
                    
        if (!name) {
            interaction.reply({ content: `That channel does not exist in the server!`, ephemeral: true});
            return;
        }

        if (!id) {
            interaction.reply({ content: `That role does not exist in the server!`, ephemeral: true })
        }
            
        if (!interaction.member.permissions.has([Permissions.FLAGS.ADMINISTRATOR])) {
            interaction.reply({ content: `You don't have the permissions to give roles!`, ephemeral: true});
            return;
        } else {
            try {
                await interaction.channel.permissionOverwrites.edit( role, { VIEW_CHANNEL: true });
                interaction.reply({ content: `${channel} has been given ${role} role!`, ephemeral: true});
            } catch(err) {
                console.log(err)
                interaction.reply({ content: `Failed to give ${role} to ${channel}!`, ephemeral: true });
                return;
            }
        }
    }
}


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source