muxinc / next-video

The easiest way to add video in your Nextjs app.
https://next-video.dev
MIT License
853 stars 32 forks source link

Vercel does not support functions inside next.config.js #304

Closed fain182 closed 3 weeks ago

fain182 commented 1 month ago

A few days ago I tried to deploy next-video with a custom configuration to save assets data in the backend, but there was a strange error, as if the saveAsset and LoadAsset functions were not defined.

I contacted Vercel support, who escalated the issue to the engineering team and informed me that:

Our internal team have identified that next-video is using the deprecated serverRuntimeConfig feature to define a function that is supposed to be accessible at runtime. Defining functions is not supported either for standalone output or Vercel deployments, as the config is serialized at built time, thus making the function property undefined at runtime.

I am a little confused about the best way to solve this...

luwes commented 1 month ago

Thanks for reporting. Strange I didn't run into this with the other functions, in dev mode it might be fine. I see Next.js itself sometimes uses string file paths in some config props, maybe that could be a solution for us too.

I will help solve this one in the upcoming weeks.

luwes commented 3 weeks ago

@fain182 we just released v1.3.0 with a separate next-video config that should solve this serialization issue.

docs can be found here: https://github.com/muxinc/next-video#asset-metadata-storage-hooks-callbacks

let me know how it goes!