oscklmO
Convex Community2y ago
7 replies
oscklm

This breaks types, and makes api / internal return any?

Hello so i just come across was was breaking api / internal types for convex in my repo:

And i'm curious to learn as of why this would break it?

This works:
'use node'
// ...imports
export const createVideo = action({
  args: video,
  handler: async (ctx, args) => {
    // Create video and return the ID
    const videoId = await ctx.runMutation(internal.videos.mutations.insert, args)

    // Create mux upload
    const upload = await client.Video.Uploads.create({
      new_asset_settings: {
        passthrough: videoId,
        playback_policy: 'public',
        max_resolution_tier: '1080p',
        encoding_tier: 'smart',
        mp4_support: 'standard',
      },
      cors_origin: '*',
    })

    return upload.url
  },
})


This breaks api / internal and make them any
'use node'
// ...imports
export const createVideo = action({
  args: video,
  handler: async (ctx, args) => {
    // Create video and return the ID
    const videoId = await ctx.runMutation(internal.videos.mutations.insert, args)

    // Create mux upload
    const upload = await client.Video.Uploads.create({
      new_asset_settings: {
        passthrough: videoId,
        playback_policy: 'public',
        max_resolution_tier: '1080p',
        encoding_tier: 'smart',
        mp4_support: 'standard',
      },
      cors_origin: '*',
    })

    return {
      videoId,
      upload,
    }
  },
})
Was this page helpful?