#Is it possible to create serverless function from code?

6 messages · Page 1 of 1 (latest)

unique needle
#

For example i want POST /api/createfunction/new body: " export default function handler(req, res) { res.end('ok'); }" I tried use build output api approach but looks like it's only works at build time

granite moatBOT
#

🔎 This post has been indexed in our web forum and will be seen by search engines so other users can find it outside Discord

      🕵️ Your user profile is private by default and won't be visible to users outside Discord, if you want to be visible in the web forum you can add the "Public Profile" role in <id:customize>

      ✅ You can mark a message as the answer for your post with `Right click -> Apps -> Mark Solution`
      (if you don't see the option, try refreshing Discord with Ctrl + R)
slim pagoda
#

are you in pages router or app router

slim pagoda
#

nvm

unique needle
# slim pagoda nvm

not sure that i understand or maybe i am not clear). I want to call api with serverless function on vercel which ll genereate another serverless function and i can call it after without rebuild a project.

#

i have error when i am trying create serverless function: Unhandled Promise Rejection {"errorType":"Runtime.UnhandledPromiseRejection","errorMessage":"Error: ENOENT: no such file or directory, mkdir '.vercel'","reason":{"errorType":"Error","errorMessage":"ENOENT: no such file or directory, mkdir '.vercel'","code":"ENOENT","errno":-2,"syscall":"mkdir","path":".vercel","stack":["Error: ENOENT: no such file or directory, mkdir '.vercel'"]},"promise":{},"stack":["Runtime.UnhandledPromiseRejection: Error: ENOENT: no such file or directory, mkdir '.vercel'"," at process.<anonymous> (file:///var/runtime/index.mjs:1189:17)"," at process.emit (node:events:525:35)"," at process.emit (/var/task/___vc/__sourcemap_support.js:602:21)"," at emit (node:internal/process/promises:149:20)"," at processPromiseRejections (node:internal/process/promises:283:27)"," at processTicksAndRejections (node:internal/process/task_queues:96:32)"]}
Unknown application error occurred
Runtime.Unknown