⚡ The following functions were not configured to run with the Edge Runtime:

i think i'm not able to build because of functions in an /api/ folder (not /pages/api). They're not configured as edge api routes because they're intended to be called from the client side. Would this make sense?
19 Replies
James
James2y ago
Hello, would I be correct in assuming that this is when using Next.js - you didn't specify?
shapeshifter
shapeshifterOP2y ago
sorry, that is correct next.js 13
James
James2y ago
If you have API routes with server functionality, or any page with server functionality, you need to specify the runtime for it. You can try doing
export const runtime = 'edge';
export const runtime = 'edge';
shapeshifter
shapeshifterOP2y ago
it doesn't have any server functionality the functions are intended as fetching helpers to the external api to be called client side
James
James2y ago
Do you have an example of the what one of the files looks like?
shapeshifter
shapeshifterOP2y ago
this is /api/api_client.ts import axios from 'axios'; import { baseUrl } from '../config'; export const ApiClient = axios.create({ baseURL: baseUrl, });
James
James2y ago
I find it rather odd that the Vercel CLI would generate a nodejs function for that, can you please share the full build log
shapeshifter
shapeshifterOP2y ago
starting at where the error occurs?
James
James2y ago
From the start of next-on-pages
James
James2y ago
This is really quite bizarre. It's listing function files that Vercel would generate for pages, yet Vercel does not list them as routes that it has generated functions for. Sorry for all the hassle, but would it be at all possible to share a reproduction so I can try and identify a cause for this?
shapeshifter
shapeshifterOP2y ago
What do you mean by reproduction so I can make sure to get you the right information?
James
James2y ago
A link to a repository that contains a nextjs app that causes an issue like the one you are experiencing.
shapeshifter
shapeshifterOP2y ago
I may not be able to share the repository because it’s private to an organization that I’m in but if you can tell me what is bizarre within that message I sent already I’ll start exploring there
James
James2y ago
The bizarre part is that we find deed.func, koda.func, and api_client.func that are non-edge functions, except the Vercel CLI does not list them as routes that it has generated a function for. When Vercel builds an application, it produces a series of serverless/edge functions, and static assets. We read those functions from the file system, and process them, so that they can be used for routing. The files that it generates under .vercel/output/functions are, in my experience, functions for pages + middleware. Now, yours appears to be generating 3 functions that have no corresponding routes. This means that at some point, something is being built that most likely shouldn't. It is possible that this might be an edge case that we need to account for and add some custom logic to next-on-pages to deal with. It's also possible that it could be an issue with how your project is structured. It is incredibly hard for us to try and debug this issue, identify a cause, or a solution without some kind of reproduction, so I'm afraid there isn't much help that can be provided otherwise. Note that a reproduction doesn't have to be a copy of your app, it could be something that has the same structure, with most of the content stripped out of it, as long as it produces the same behavior that you are seeing.
shapeshifter
shapeshifterOP2y ago
Let me see what I can do for you to get something with the same behavior
James
James2y ago
Appreciated.
shapeshifter
shapeshifterOP2y ago
Appreciate you! Thank you for your help @5927 chaged the folder from /api/ to /fetchHelpers/ and it fixed it
James
James2y ago
Sounds like it might have been a bug with next/vercel trying to build functions for a directory called api that it shouldn't have then, considering it wasn't inside your pages directory. Strange
Want results from more Discord servers?
Add your server