Nested api paths in Nextjs results in 500 error

Hi Forum,

I hope someone can help, I’ve got a problem with nested paths in my project /pages/api/.
Example project.

When i call an endpoint in the next js using /api/presentations/index.ts i get a 200 response,
but when i call /api/presentations/list/index.ts i get 500 response.

Then files are identical, just located in different places.

I can post data to /api/login and fetch from /api/user , but once i use the nested paths it fails with 500 error.
netlify.toml file

[build.processing.js]
  bundle = false

[[plugins]]
  package = "@netlify/plugin-nextjs"

Build log in case it helps :slight_smile:

───────────────────────────────────────────
4:43:56 PM:   Netlify Build                                                 
4:43:56 PM: ────────────────────────────────────────────────────────────────
4:43:56 PM: ​
4:43:56 PM: ❯ Version
4:43:56 PM:   @netlify/build 28.1.3
4:43:56 PM: ​
4:43:56 PM: ❯ Flags
4:43:56 PM:   baseRelDir: true
4:43:56 PM:   buildId: 6357f606c1f57e00081d79c2
4:43:56 PM:   deployId: 6357f607c1f57e00081d79c4
4:43:56 PM: ​
4:43:56 PM: ❯ Current directory
4:43:56 PM:   /opt/build/repo
4:43:56 PM: ​
4:43:56 PM: ❯ Config file
4:43:56 PM:   /opt/build/repo/netlify.toml
4:43:56 PM: ​
4:43:56 PM: ❯ Context
4:43:56 PM:   deploy-preview
4:43:56 PM: ​
4:43:56 PM: ❯ Using Next.js Runtime - v4.27.2
4:43:56 PM: ​
4:43:56 PM: ❯ Outdated plugins
4:43:56 PM:    - @netlify/plugin-nextjs@4.27.2: latest version is 4.27.3
4:43:56 PM:      Migration guide: https://ntl.fyi/next-plugin-migration
4:43:56 PM:      To upgrade this plugin, please update its version in "package.json"
4:43:58 PM: ​
4:43:58 PM: ────────────────────────────────────────────────────────────────
4:43:58 PM:   1. @netlify/plugin-nextjs (onPreBuild event)                  
4:43:58 PM: ────────────────────────────────────────────────────────────────
4:43:58 PM: ​
4:43:58 PM: Next.js cache restored.
4:43:58 PM: Netlify configuration property "build.environment.NEXT_PRIVATE_TARGET" value changed.
4:43:58 PM: ​
4:43:58 PM: (@netlify/plugin-nextjs onPreBuild completed in 155ms)
4:43:58 PM: ​
4:43:58 PM: ────────────────────────────────────────────────────────────────
4:43:58 PM:   2. Build command from Netlify app                             
4:43:58 PM: ────────────────────────────────────────────────────────────────
4:43:58 PM: ​
4:43:58 PM: $ yarn build
4:43:58 PM: yarn run v1.22.19
4:43:58 PM: $ next build
4:43:59 PM: info  - Checking validity of types...
4:44:08 PM: ./src/pages/_app.tsx
4:44:08 PM: info  - Need to disable some ESLint rules? Learn more here: https://nextjs.org/docs/basic-features/eslint#disabling-rules
4:44:08 PM: info  - Creating an optimized production build...
4:44:14 PM: info  - Compiled successfully
4:44:14 PM: info  - Collecting page data...
4:44:16 PM: info  - Generating static pages (0/26)
4:44:17 PM: info  - Generating static pages (6/26)
4:44:17 PM: info  - Generating static pages (12/26)
4:44:17 PM: info  - Generating static pages (19/26)
4:44:17 PM: info  - Generating static pages (26/26)
4:44:17 PM: info  - Finalizing page optimization...
4:44:17 PM: Page                                                 Size     First Load JS
4:44:17 PM: β”Œ β—‹ /                                                1.28 kB         190 kB
4:44:17 PM: β”œ   β”” css/6f8444896e93d7be.css                       371 B
4:44:17 PM: β”œ   /_app                                            0 B             189 kB
4:44:17 PM: β”œ β—‹ /404                                             194 B           189 kB
4:44:17 PM: β”œ β—‹ /academy                                         823 B           190 kB
4:44:17 PM: β”œ   β”” css/d7da8e21c4825e49.css                       280 B
4:44:17 PM: β”œ β—‹ /admin-area                                      1.76 kB         200 kB
4:44:17 PM: β”œ β—‹ /admin-area/admin-area                           1.79 kB         200 kB
4:44:17 PM: β”œ β—‹ /admin-area/partials/academy-statistics-members  2.57 kB         191 kB
4:44:17 PM: β”œ β—‹ /admin-area/partials/academy-statistics-videos   2.48 kB         191 kB
4:44:17 PM: β”œ β—‹ /admin-area/partials/academy-statistics-view     2.1 kB          194 kB
4:44:17 PM: β”œ   β”” css/29604549882893e3.css                       1.41 kB
4:44:17 PM: β”œ β—‹ /admin-area/partials/registered-clients-view     228 B           195 kB
4:44:17 PM: β”œ   β”” css/146b15ba8a685da1.css                       1.09 kB
4:44:17 PM: β”œ β—‹ /analytics                                       3.9 kB          193 kB
4:44:17 PM: β”œ   β”” css/e61cb3ea34a90587.css                       1.26 kB
4:44:17 PM: β”œ Ξ» /api/analytics/[...uuid]                         0 B             189 kB
4:44:17 PM: β”œ Ξ» /api/login                                       0 B             189 kB
4:44:17 PM: β”œ Ξ» /api/presentationlist                            0 B             189 kB
4:44:17 PM: β”œ Ξ» /api/presentations                               0 B             189 kB
4:44:17 PM: β”œ Ξ» /api/presentations/[uuid]                        0 B             189 kB
4:44:17 PM: β”œ Ξ» /api/presentations/[uuid]/archive                0 B             189 kB
4:44:17 PM: β”œ Ξ» /api/presentations/[uuid]/duplicate              0 B             189 kB
4:44:17 PM: β”œ Ξ» /api/presentations/[uuid]/edit                   0 B             189 kB
4:44:17 PM: β”œ Ξ» /api/presentations/[uuid]/share                  0 B             189 kB
4:44:17 PM: β”œ Ξ» /api/presentations/brands                        0 B             189 kB
4:44:17 PM: β”œ Ξ» /api/presentations/categories                    0 B             189 kB
4:44:17 PM: β”œ Ξ» /api/presentations/create                        0 B             189 kB
4:44:17 PM: β”œ Ξ» /api/presentations/list                          0 B             189 kB
4:44:17 PM: β”œ Ξ» /api/presentations/list/archived                 0 B             189 kB
4:44:17 PM: β”œ Ξ» /api/presentations/regions                       0 B             189 kB
4:44:17 PM: β”œ Ξ» /api/presentations/segments                      0 B             189 kB
4:44:17 PM: β”œ Ξ» /api/presentations/slides/[uuid]                 0 B             189 kB
4:44:17 PM: β”œ Ξ» /api/products/[uuid]                             0 B             189 kB
4:44:17 PM: β”œ Ξ» /api/slides/list                                 0 B             189 kB
4:44:17 PM: β”œ Ξ» /api/slides/list/[uuid]                          0 B             189 kB
4:44:17 PM: β”œ Ξ» /api/track                                       0 B             189 kB
4:44:17 PM: β”œ Ξ» /api/user                                        0 B             189 kB
4:44:17 PM: β”œ Ξ» /api/user/logout                                 0 B             189 kB
4:44:17 PM: β”œ β—‹ /login (322 ms)                                  2.76 kB         207 kB
4:44:17 PM: β”œ β—‹ /login/login (332 ms)                            2.74 kB         207 kB
4:44:17 PM: β”œ β—‹ /login/partials/login-form (319 ms)              215 B           204 kB
4:44:17 PM: β”œ β—‹ /login/partials/reset-password-form (313 ms)     3.62 kB         204 kB
4:44:17 PM: β”œ β—‹ /new-presentation (319 ms)                       20.2 kB         247 kB
4:44:17 PM: β”œ   β”” css/c4d978f0f363e3a0.css                       2.14 kB
4:44:17 PM: β”œ Ξ» /p/[...presentationView]                         4.19 kB         248 kB
4:44:17 PM: β”œ   β”” css/1ca5905b333b822e.css                       2.11 kB
4:44:17 PM: β”œ β—‹ /presentation-statistics                         2.89 kB         192 kB
4:44:17 PM: β”œ   β”” css/453c9c54a5a3d55c.css                       962 B
4:44:17 PM: β”œ β—‹ /presentations                                   8.84 kB         229 kB
4:44:17 PM: β”œ   β”” css/8609ac4ecbb1d239.css                       2.39 kB
4:44:17 PM: β”œ β—‹ /presentations/edit/[uuid] (335 ms)              1.84 kB         228 kB
4:44:17 PM: β”œ   β”” css/841c7a4a1792c4d1.css                       1.97 kB
4:44:17 PM: β”œ β—‹ /product/[uuid] (352 ms)                         1.46 kB         245 kB
4:44:17 PM: β”œ   β”” css/d3e5654b7a3c170d.css                       488 B
4:44:17 PM: β”œ β—‹ /slides                                          2.83 kB         207 kB
4:44:17 PM: β”œ   β”” css/31e4f25f68bd6cdd.css                       1.08 kB
4:44:17 PM: β”œ β—‹ /slides/[...uuid] (338 ms)                       1.52 kB         245 kB
4:44:17 PM: β”œ β—‹ /styleguide                                      699 B           190 kB
4:44:17 PM: β”œ β—‹ /styleguide/components/test                      351 B           189 kB
4:44:17 PM: β”œ β—‹ /styleguide/components/test/test                 337 B           189 kB
4:44:17 PM: β”” β—‹ /styleguide/styleguide                           686 B           190 kB
4:44:17 PM: + First Load JS shared by all                        189 kB
4:44:17 PM:   β”œ chunks/framework-5f4595e5518b5600.js             42 kB
4:44:17 PM:   β”œ chunks/main-a054bbf31fb90f6a.js                  27.6 kB
4:44:17 PM:   β”œ chunks/pages/_app-ba813bf9fcb548ad.js            118 kB
4:44:17 PM:   β”œ chunks/webpack-cb7634a8b6194820.js               884 B
4:44:17 PM:   β”” css/8464ab031c7d756c.css                         2.65 kB
4:44:17 PM: Ξ»  (Server)  server-side renders at runtime (uses getInitialProps or getServerSideProps)
4:44:17 PM: β—‹  (Static)  automatically rendered as static HTML (uses no initial props)
4:44:17 PM: Done in 19.33s.
4:44:17 PM: ​
4:44:17 PM: (build.command completed in 19.5s)
4:44:17 PM: ​
4:44:17 PM: ────────────────────────────────────────────────────────────────
4:44:17 PM:   3. @netlify/plugin-nextjs (onBuild event)                     
4:44:17 PM: ────────────────────────────────────────────────────────────────
4:44:17 PM: ​
4:44:17 PM: Could not find source file for page /api/analytics/[...uuid]
4:44:17 PM: Could not find source file for page /api/login
4:44:17 PM: Could not find source file for page /api/presentationlist
4:44:17 PM: Could not find source file for page /api/presentations/[uuid]/archive
4:44:17 PM: Could not find source file for page /api/presentations/[uuid]/duplicate
4:44:17 PM: Could not find source file for page /api/presentations/[uuid]/edit
4:44:17 PM: Could not find source file for page /api/presentations/[uuid]
4:44:17 PM: Could not find source file for page /api/presentations/[uuid]/share
4:44:17 PM: Could not find source file for page /api/presentations/brands
4:44:17 PM: Could not find source file for page /api/presentations/categories
4:44:17 PM: Could not find source file for page /api/presentations/create
4:44:17 PM: Could not find source file for page /api/presentations
4:44:17 PM: Could not find source file for page /api/presentations/list/archived
4:44:17 PM: Could not find source file for page /api/presentations/list
4:44:17 PM: Could not find source file for page /api/presentations/regions
4:44:17 PM: Could not find source file for page /api/presentations/segments
4:44:17 PM: Could not find source file for page /api/presentations/slides/[uuid]
4:44:17 PM: Could not find source file for page /api/products/[uuid]
4:44:17 PM: Could not find source file for page /api/slides/list/[uuid]
4:44:17 PM: Could not find source file for page /api/slides/list
4:44:17 PM: Could not find source file for page /api/track
4:44:17 PM: Could not find source file for page /api/user
4:44:17 PM: Could not find source file for page /api/user/logout
4:44:17 PM: { functionsDir: '/opt/build/repo/.netlify/functions-internal' }
4:44:17 PM: Patching /opt/build/repo/node_modules/next/dist/server/base-server.js
4:44:17 PM: Done
4:44:17 PM: Patching /opt/build/repo/node_modules/next/dist/server/next-server.js
4:44:17 PM: Done
4:44:17 PM: Moving static page files to serve from CDN...
4:44:17 PM: Moved 21 files
4:44:17 PM: Using Netlify Edge Functions for image format detection. Set env var "NEXT_DISABLE_EDGE_IMAGES=true" to disable.
4:44:17 PM: Netlify configuration property "redirects" value changed to [
4:44:17 PM:   { from: '/_next/static/*', to: '/static/:splat', status: 200 },
4:44:17 PM:   {
4:44:17 PM:     from: '/_next/image*',
4:44:17 PM:     query: { url: ':url', w: ':width', q: ':quality' },
4:44:17 PM:     to: '/_ipx/w_:width,q_:quality/:url',
4:44:17 PM:     status: 301
4:44:17 PM:   },
4:44:17 PM:   { from: '/_ipx/*', to: '/.netlify/builders/_ipx', status: 200 },
4:44:17 PM:   { from: '/cache/*', to: '/404.html', status: 404, force: true },
4:44:17 PM:   { from: '/server/*', to: '/404.html', status: 404, force: true },
4:44:17 PM:   { from: '/serverless/*', to: '/404.html', status: 404, force: true },
4:44:17 PM:   { from: '/trace', to: '/404.html', status: 404, force: true },
4:44:17 PM:   { from: '/traces', to: '/404.html', status: 404, force: true },
4:44:17 PM:   {
4:44:17 PM:     from: '/routes-manifest.json',
4:44:17 PM:     to: '/404.html',
4:44:17 PM:     status: 404,
4:44:17 PM:     force: true
4:44:17 PM:   },
4:44:17 PM:   {
4:44:17 PM:     from: '/build-manifest.json',
4:44:17 PM:     to: '/404.html',
4:44:17 PM:     status: 404,
4:44:17 PM:     force: true
4:44:17 PM:   },
4:44:17 PM:   {
4:44:17 PM:     from: '/prerender-manifest.json',
4:44:17 PM:     to: '/404.html',
4:44:17 PM:     status: 404,
4:44:17 PM:     force: true
4:44:17 PM:   },
4:44:17 PM:   {
4:44:17 PM:     from: '/react-loadable-manifest.json',
4:44:17 PM:     to: '/404.html',
4:44:17 PM:     status: 404,
4:44:17 PM:     force: true
4:44:17 PM:   },
4:44:17 PM:   { from: '/BUILD_ID', to: '/404.html', status: 404, force: true },
4:44:17 PM:   {
4:44:17 PM:     from: '/api/analytics/:uuid/*',
4:44:17 PM:     to: '/.netlify/functions/_api_analytics_uuid-SPLAT-handler',
4:44:17 PM:     status: 200
4:44:17 PM:   },
4:44:17 PM:   {
4:44:17 PM:     from: '/api/login',
4:44:17 PM:     to: '/.netlify/functions/_api_login-handler',
4:44:17 PM:     status: 200
4:44:17 PM:   },
4:44:17 PM:   {
4:44:17 PM:     from: '/api/presentationlist',
4:44:17 PM:     to: '/.netlify/functions/_api_presentationlist-handler',
4:44:17 PM:     status: 200
4:44:17 PM:   },
4:44:17 PM:   {
4:44:17 PM:     from: '/api/presentations/:uuid/archive',
4:44:17 PM:     to: '/.netlify/functions/_api_presentations_uuid-PARAM_archive-handler',
4:44:17 PM:     status: 200
4:44:17 PM:   },
4:44:17 PM:   {
4:44:17 PM:     from: '/api/presentations/:uuid/duplicate',
4:44:17 PM:     to: '/.netlify/functions/_api_presentations_uuid-PARAM_duplicate-handler',
4:44:17 PM:     status: 200
4:44:17 PM:   },
4:44:17 PM:   {
4:44:17 PM:     from: '/api/presentations/:uuid/edit',
4:44:17 PM:     to: '/.netlify/functions/_api_presentations_uuid-PARAM_edit-handler',
4:44:17 PM:     status: 200
4:44:17 PM:   },
4:44:17 PM:   {
4:44:17 PM:     from: '/api/presentations/:uuid',
4:44:17 PM:     to: '/.netlify/functions/_api_presentations_uuid-PARAM-handler',
4:44:17 PM:     status: 200
4:44:17 PM:   },
4:44:17 PM:   {
4:44:17 PM:     from: '/api/presentations/:uuid/share',
4:44:17 PM:     to: '/.netlify/functions/_api_presentations_uuid-PARAM_share-handler',
4:44:17 PM:     status: 200
4:44:17 PM:   },
4:44:17 PM:   {
4:44:17 PM:     from: '/api/presentations/brands',
4:44:17 PM:     to: '/.netlify/functions/_api_presentations_brands-handler',
4:44:17 PM:     status: 200
4:44:17 PM:   },
4:44:17 PM:   {
4:44:17 PM:     from: '/api/presentations/categories',
4:44:17 PM:     to: '/.netlify/functions/_api_presentations_categories-handler',
4:44:17 PM:     status: 200
4:44:17 PM:   },
4:44:17 PM:   {
4:44:17 PM:     from: '/api/presentations/create',
4:44:17 PM:     to: '/.netlify/functions/_api_presentations_create-handler',
4:44:17 PM:     status: 200
4:44:17 PM:   },
4:44:17 PM:   {
4:44:17 PM:     from: '/api/presentations',
4:44:17 PM:     to: '/.netlify/functions/_api_presentations-handler',
4:44:17 PM:     status: 200
4:44:17 PM:   },
4:44:17 PM:   {
4:44:17 PM:     from: '/api/presentations/list/archived',
4:44:17 PM:     to: '/.netlify/functions/_api_presentations_list_archived-handler',
4:44:17 PM:     status: 200
4:44:17 PM:   },
4:44:17 PM:   {
4:44:17 PM:     from: '/api/presentations/list',
4:44:17 PM:     to: '/.netlify/functions/_api_presentations_list-handler',
4:44:17 PM:     status: 200
4:44:17 PM:   },
4:44:17 PM:   {
4:44:17 PM:     from: '/api/presentations/regions',
4:44:17 PM:     to: '/.netlify/functions/_api_presentations_regions-handler',
4:44:17 PM:     status: 200
4:44:17 PM:   },
4:44:17 PM:   {
4:44:17 PM:     from: '/api/presentations/segments',
4:44:17 PM:     to: '/.netlify/functions/_api_presentations_segments-handler',
4:44:17 PM:     status: 200
4:44:17 PM:   },
4:44:17 PM:   {
4:44:17 PM:     from: '/api/presentations/slides/:uuid',
4:44:17 PM:     to: '/.netlify/functions/_api_presentations_slides_uuid-PARAM-handler',
4:44:17 PM:     status: 200
4:44:17 PM:   },
4:44:17 PM:   {
4:44:17 PM:     from: '/api/products/:uuid',
4:44:17 PM:     to: '/.netlify/functions/_api_products_uuid-PARAM-handler',
4:44:17 PM:     status: 200
4:44:17 PM:   },
4:44:17 PM:   {
4:44:17 PM:     from: '/api/slides/list/:uuid',
4:44:17 PM:     to: '/.netlify/functions/_api_slides_list_uuid-PARAM-handler',
4:44:17 PM:     status: 200
4:44:17 PM:   },
4:44:17 PM:   {
4:44:17 PM:     from: '/api/slides/list',
4:44:17 PM:     to: '/.netlify/functions/_api_slides_list-handler',
4:44:17 PM:     status: 200
4:44:17 PM:   },
4:44:17 PM:   {
4:44:17 PM:     from: '/api/track',
4:44:17 PM:     to: '/.netlify/functions/_api_track-handler',
4:44:17 PM:     status: 200
4:44:17 PM:   },
4:44:17 PM:   {
4:44:17 PM:     from: '/api/user',
4:44:17 PM:     to: '/.netlify/functions/_api_user-handler',
4:44:17 PM:     status: 200
4:44:17 PM:   },
4:44:17 PM:   {
4:44:17 PM:     from: '/api/user/logout',
4:44:17 PM:     to: '/.netlify/functions/_api_user_logout-handler',
4:44:17 PM:     status: 200
4:44:17 PM:   },
4:44:17 PM:   {
4:44:17 PM:     from: '/api/*',
4:44:17 PM:     to: '/.netlify/functions/___netlify-handler',
4:44:17 PM:     status: 200
4:44:17 PM:   },
4:44:17 PM:   {
4:44:17 PM:     from: '/favicon.ico',
4:44:17 PM:     to: '/favicon.ico',
4:44:17 PM:     conditions: { Cookie: [Array] },
4:44:17 PM:     status: 200
4:44:17 PM:   },
4:44:17 PM:   {
4:44:17 PM:     from: '/login.webp',
4:44:17 PM:     to: '/login.webp',
4:44:17 PM:     conditions: { Cookie: [Array] },
4:44:17 PM:     status: 200
4:44:17 PM:   },
4:44:17 PM:   {
4:44:17 PM:     from: '/*',
4:44:17 PM:     to: '/.netlify/functions/___netlify-handler',
4:44:17 PM:     status: 200,
4:44:17 PM:     conditions: { Cookie: [Array] },
4:44:17 PM:     force: true
4:44:17 PM:   },
4:44:17 PM:   {
4:44:17 PM:     from: '/_next/data/vD79iJPlpwkhj8qGnsCyY/index.json',
4:44:17 PM:     to: '/.netlify/functions/___netlify-handler',
4:44:17 PM:     status: 200,
4:44:17 PM:     force: false
4:44:17 PM:   },
4:44:17 PM:   {
4:44:17 PM:     from: '/',
4:44:17 PM:     to: '/.netlify/functions/___netlify-handler',
4:44:17 PM:     status: 200,
4:44:17 PM:     force: false
4:44:17 PM:   },
4:44:17 PM:   {
4:44:17 PM:     from: '/_next/data/vD79iJPlpwkhj8qGnsCyY/academy.json',
4:44:17 PM:     to: '/.netlify/functions/___netlify-handler',
4:44:17 PM:     status: 200,
4:44:17 PM:     force: false
4:44:17 PM:   },
4:44:17 PM:   {
4:44:17 PM:     from: '/academy',
4:44:17 PM:     to: '/.netlify/functions/___netlify-handler',
4:44:17 PM:     status: 200,
4:44:17 PM:     force: false
4:44:17 PM:   },
4:44:17 PM:   {
4:44:17 PM:     from: '/_next/data/vD79iJPlpwkhj8qGnsCyY/admin-area.json',
4:44:17 PM:     to: '/.netlify/functions/___netlify-handler',
4:44:17 PM:     status: 200,
4:44:17 PM:     force: false
4:44:17 PM:   },
4:44:17 PM:   {
4:44:17 PM:     from: '/admin-area',
4:44:17 PM:     to: '/.netlify/functions/___netlify-handler',
4:44:17 PM:     status: 200,
4:44:17 PM:     force: false
4:44:17 PM:   },
4:44:17 PM:   {
4:44:17 PM:     from: '/_next/data/vD79iJPlpwkhj8qGnsCyY/admin-area/admin-area.json',
4:44:17 PM:     to: '/.netlify/functions/___netlify-handler',
4:44:17 PM:     status: 200,
4:44:17 PM:     force: false
4:44:17 PM:   },
4:44:17 PM:   {
4:44:17 PM:     from: '/admin-area/admin-area',
4:44:17 PM:     to: '/.netlify/functions/___netlify-handler',
4:44:17 PM:     status: 200,
4:44:17 PM:     force: false
4:44:17 PM:   },
4:44:17 PM:   {
4:44:17 PM:     from: '/_next/data/vD79iJPlpwkhj8qGnsCyY/admin-area/partials/academy-statistics-members.json',
4:44:17 PM:     to: '/.netlify/functions/___netlify-handler',
4:44:17 PM:     status: 200,
4:44:17 PM:     force: false
4:44:17 PM:   },
4:44:17 PM:   {
4:44:17 PM:     from: '/admin-area/partials/academy-statistics-members',
4:44:17 PM:     to: '/.netlify/functions/___netlify-handler',
4:44:17 PM:     status: 200,
4:44:17 PM:     force: false
4:44:17 PM:   },
4:44:17 PM:   {
4:44:17 PM:     from: '/_next/data/vD79iJPlpwkhj8qGnsCyY/admin-area/partials/academy-statistics-videos.json',
4:44:17 PM:     to: '/.netlify/functions/___netlify-handler',
4:44:17 PM:     status: 200,
4:44:17 PM:     force: false
4:44:17 PM:   },
4:44:17 PM:   {
4:44:17 PM:     from: '/admin-area/partials/academy-statistics-videos',
4:44:17 PM:     to: '/.netlify/functions/___netlify-handler',
4:44:17 PM:     status: 200,
4:44:17 PM:     force: false
4:44:17 PM:   },
4:44:17 PM:   {
4:44:17 PM:     from: '/_next/data/vD79iJPlpwkhj8qGnsCyY/admin-area/partials/academy-statistics-view.json',
4:44:17 PM:     to: '/.netlify/functions/___netlify-handler',
4:44:17 PM:     status: 200,
4:44:17 PM:     force: false
4:44:17 PM:   },
4:44:17 PM:   {
4:44:17 PM:     from: '/admin-area/partials/academy-statistics-view',
4:44:17 PM:     to: '/.netlify/functions/___netlify-handler',
4:44:17 PM:     status: 200,
4:44:17 PM:     force: false
4:44:17 PM:   },
4:44:17 PM:   {
4:44:17 PM:     from: '/_next/data/vD79iJPlpwkhj8qGnsCyY/admin-area/partials/registered-clients-view.json',
4:44:17 PM:     to: '/.netlify/functions/___netlify-handler',
4:44:17 PM:     status: 200,
4:44:17 PM:     force: false
4:44:17 PM:   },
4:44:17 PM:   {
4:44:17 PM:     from: '/admin-area/partials/registered-clients-view',
4:44:17 PM:     to: '/.netlify/functions/___netlify-handler',
4:44:17 PM:     status: 200,
4:44:17 PM:     force: false
4:44:17 PM:   },
4:44:17 PM:   {
4:44:17 PM:     from: '/_next/data/vD79iJPlpwkhj8qGnsCyY/analytics.json',
4:44:17 PM:     to: '/.netlify/functions/___netlify-handler',
4:44:17 PM:     status: 200,
4:44:17 PM:     force: false
4:44:17 PM:   },
4:44:17 PM:   {
4:44:17 PM:     from: '/analytics',
4:44:17 PM:     to: '/.netlify/functions/___netlify-handler',
4:44:17 PM:     status: 200,
4:44:17 PM:     force: false
4:44:17 PM:   },
4:44:17 PM:   {
4:44:17 PM:     from: '/_next/data/vD79iJPlpwkhj8qGnsCyY/login.json',
4:44:17 PM:     to: '/.netlify/functions/___netlify-handler',
4:44:17 PM:     status: 200,
4:44:17 PM:     force: false
4:44:17 PM:   },
4:44:17 PM:   {
4:44:17 PM:     from: '/login',
4:44:17 PM:     to: '/.netlify/functions/___netlify-handler',
4:44:17 PM:     status: 200,
4:44:17 PM:     force: false
4:44:17 PM:   },
4:44:17 PM:   {
4:44:17 PM:     from: '/_next/data/vD79iJPlpwkhj8qGnsCyY/login/login.json',
4:44:17 PM:     to: '/.netlify/functions/___netlify-handler',
4:44:17 PM:     status: 200,
4:44:17 PM:     force: false
4:44:17 PM:   },
4:44:17 PM:   {
4:44:17 PM:     from: '/login/login',
4:44:17 PM:     to: '/.netlify/functions/___netlify-handler',
4:44:17 PM:     status: 200,
4:44:17 PM:     force: false
4:44:17 PM:   },
4:44:17 PM:   {
4:44:17 PM:     from: '/_next/data/vD79iJPlpwkhj8qGnsCyY/login/partials/login-form.json',
4:44:17 PM:     to: '/.netlify/functions/___netlify-handler',
4:44:17 PM:     status: 200,
4:44:17 PM:     force: false
4:44:17 PM:   },
4:44:17 PM:   {
4:44:17 PM:     from: '/login/partials/login-form',
4:44:17 PM:     to: '/.netlify/functions/___netlify-handler',
4:44:17 PM:     status: 200,
4:44:17 PM:     force: false
4:44:17 PM:   },
4:44:17 PM:   {
4:44:17 PM:     from: '/_next/data/vD79iJPlpwkhj8qGnsCyY/login/partials/reset-password-form.json',
4:44:17 PM:     to: '/.netlify/functions/___netlify-handler',
4:44:17 PM:     status: 200,
4:44:17 PM:     force: false
4:44:17 PM:   },
4:44:17 PM:   {
4:44:17 PM:     from: '/login/partials/reset-password-form',
4:44:17 PM:     to: '/.netlify/functions/___netlify-handler',
4:44:17 PM:     status: 200,
4:44:17 PM:     force: false
4:44:17 PM:   },
4:44:17 PM:   {
4:44:17 PM:     from: '/_next/data/vD79iJPlpwkhj8qGnsCyY/new-presentation.json',
4:44:17 PM:     to: '/.netlify/functions/___netlify-handler',
4:44:17 PM:     status: 200,
4:44:17 PM:     force: false
4:44:17 PM:   },
4:44:17 PM:   {
4:44:17 PM:     from: '/new-presentation',
4:44:17 PM:     to: '/.netlify/functions/___netlify-handler',
4:44:17 PM:     status: 200,
4:44:17 PM:     force: false
4:44:17 PM:   },
4:44:17 PM:   {
4:44:17 PM:     from: '/_next/data/vD79iJPlpwkhj8qGnsCyY/presentation-statistics.json',
4:44:17 PM:     to: '/.netlify/functions/___netlify-handler',
4:44:17 PM:     status: 200,
4:44:17 PM:     force: false
4:44:17 PM:   },
4:44:17 PM:   {
4:44:17 PM:     from: '/presentation-statistics',
4:44:17 PM:     to: '/.netlify/functions/___netlify-handler',
4:44:17 PM:     status: 200,
4:44:17 PM:     force: false
4:44:17 PM:   },
4:44:17 PM:   {
4:44:17 PM:     from: '/_next/data/vD79iJPlpwkhj8qGnsCyY/presentations.json',
4:44:17 PM:     to: '/.netlify/functions/___netlify-handler',
4:44:17 PM:     status: 200,
4:44:17 PM:     force: false
4:44:17 PM:   },
4:44:17 PM:   {
4:44:17 PM:     from: '/presentations',
4:44:17 PM:     to: '/.netlify/functions/___netlify-handler',
4:44:17 PM:     status: 200,
4:44:17 PM:     force: false
4:44:17 PM:   },
4:44:17 PM:   {
4:44:17 PM:     from: '/_next/data/vD79iJPlpwkhj8qGnsCyY/slides.json',
4:44:17 PM:     to: '/.netlify/functions/___netlify-handler',
4:44:17 PM:     status: 200,
4:44:17 PM:     force: false
4:44:17 PM:   },
4:44:17 PM:   {
4:44:17 PM:     from: '/slides',
4:44:17 PM:     to: '/.netlify/functions/___netlify-handler',
4:44:17 PM:     status: 200,
4:44:17 PM:     force: false
4:44:17 PM:   },
4:44:17 PM:   {
4:44:17 PM:     from: '/_next/data/vD79iJPlpwkhj8qGnsCyY/styleguide.json',
4:44:17 PM:     to: '/.netlify/functions/___netlify-handler',
4:44:17 PM:     status: 200,
4:44:17 PM:     force: false
4:44:17 PM:   },
4:44:17 PM:   {
4:44:17 PM:     from: '/styleguide',
4:44:17 PM:     to: '/.netlify/functions/___netlify-handler',
4:44:17 PM:     status: 200,
4:44:17 PM:     force: false
4:44:17 PM:   },
4:44:17 PM:   {
4:44:17 PM:     from: '/_next/data/vD79iJPlpwkhj8qGnsCyY/styleguide/components/test.json',
4:44:17 PM:     to: '/.netlify/functions/___netlify-handler',
4:44:17 PM:     status: 200,
4:44:17 PM:     force: false
4:44:17 PM:   },
4:44:17 PM:   {
4:44:17 PM:     from: '/styleguide/components/test',
4:44:17 PM:     to: '/.netlify/functions/___netlify-handler',
4:44:17 PM:     status: 200,
4:44:17 PM:     force: false
4:44:17 PM:   },
4:44:17 PM:   {
4:44:17 PM:     from: '/_next/data/vD79iJPlpwkhj8qGnsCyY/styleguide/components/test/test.json',
4:44:17 PM:     to: '/.netlify/functions/___netlify-handler',
4:44:17 PM:     status: 200,
4:44:17 PM:     force: false
4:44:17 PM:   },
4:44:17 PM:   {
4:44:17 PM:     from: '/styleguide/components/test/test',
4:44:17 PM:     to: '/.netlify/functions/___netlify-handler',
4:44:17 PM:     status: 200,
4:44:17 PM:     force: false
4:44:17 PM:   },
4:44:17 PM:   {
4:44:17 PM:     from: '/_next/data/vD79iJPlpwkhj8qGnsCyY/styleguide/styleguide.json',
4:44:17 PM:     to: '/.netlify/functions/___netlify-handler',
4:44:17 PM:     status: 200,
4:44:17 PM:     force: false
4:44:17 PM:   },
4:44:17 PM:   {
4:44:17 PM:     from: '/styleguide/styleguide',
4:44:17 PM:     to: '/.netlify/functions/___netlify-handler',
4:44:17 PM:     status: 200,
4:44:17 PM:     force: false
4:44:17 PM:   },
4:44:17 PM:   {
4:44:17 PM:     from: '/_next/data/vD79iJPlpwkhj8qGnsCyY/p/:presentationView/*',
4:44:17 PM:     to: '/.netlify/functions/___netlify-handler',
4:44:17 PM:     status: 200,
4:44:17 PM:     force: false
4:44:17 PM:   },
4:44:17 PM:   {
4:44:17 PM:     from: '/p/:presentationView/*',
4:44:17 PM:     to: '/.netlify/functions/___netlify-handler',
4:44:17 PM:     status: 200,
4:44:17 PM:     force: false
4:44:17 PM:   },
4:44:17 PM:   {
4:44:17 PM:     from: '/_next/data/vD79iJPlpwkhj8qGnsCyY/presentations/edit/:uuid.json',
4:44:17 PM:     to: '/.netlify/functions/___netlify-handler',
4:44:17 PM:     status: 200,
4:44:17 PM:     force: false
4:44:17 PM:   },
4:44:17 PM:   {
4:44:17 PM:     from: '/presentations/edit/:uuid',
4:44:17 PM:     to: '/.netlify/functions/___netlify-handler',
4:44:17 PM:     status: 200,
4:44:17 PM:     force: false
4:44:17 PM:   },
4:44:17 PM:   {
4:44:17 PM:     from: '/_next/data/vD79iJPlpwkhj8qGnsCyY/product/:uuid.json',
4:44:17 PM:     to: '/.netlify/functions/___netlify-handler',
4:44:17 PM:     status: 200,
4:44:17 PM:     force: false
4:44:17 PM:   },
4:44:17 PM:   {
4:44:17 PM:     from: '/product/:uuid',
4:44:17 PM:     to: '/.netlify/functions/___netlify-handler',
4:44:17 PM:     status: 200,
4:44:17 PM:     force: false
4:44:17 PM:   },
4:44:17 PM:   {
4:44:17 PM:     from: '/_next/data/vD79iJPlpwkhj8qGnsCyY/slides/:uuid/*',
4:44:17 PM:     to: '/.netlify/functions/___netlify-handler',
4:44:17 PM:     status: 200,
4:44:17 PM:     force: false
4:44:17 PM:   },
4:44:17 PM:   {
4:44:17 PM:     from: '/slides/:uuid/*',
4:44:17 PM:     to: '/.netlify/functions/___netlify-handler',
4:44:17 PM:     status: 200,
4:44:17 PM:     force: false
4:44:17 PM:   },
4:44:17 PM:   {
4:44:17 PM:     from: '/*',
4:44:17 PM:     to: '/.netlify/functions/___netlify-handler',
4:44:17 PM:     status: 200
4:44:17 PM:   }
4:44:17 PM: ].
4:44:17 PM: ​
4:44:17 PM: (@netlify/plugin-nextjs onBuild completed in 106ms)
4:44:17 PM: ​
4:44:17 PM: ────────────────────────────────────────────────────────────────
4:44:17 PM:   4. Functions bundling                                         
4:44:17 PM: ────────────────────────────────────────────────────────────────
4:44:17 PM: ​
4:44:18 PM: Packaging Functions from .netlify/functions-internal directory:
4:44:18 PM:  - ___netlify-handler/___netlify-handler.js
4:44:18 PM:  - ___netlify-odb-handler/___netlify-odb-handler.js
4:44:18 PM:  - _api_analytics_uuid-SPLAT-handler/_api_analytics_uuid-SPLAT-handler.js
4:44:18 PM:  - _api_login-handler/_api_login-handler.js
4:44:18 PM:  - _api_presentationlist-handler/_api_presentationlist-handler.js
4:44:18 PM:  - _api_presentations-handler/_api_presentations-handler.js
4:44:18 PM:  - _api_presentations_brands-handler/_api_presentations_brands-handler.js
4:44:18 PM:  - _api_presentations_categories-handler/_api_presentations_categories-handler.js
4:44:18 PM:  - _api_presentations_create-handler/_api_presentations_create-handler.js
4:44:18 PM:  - _api_presentations_list-handler/_api_presentations_list-handler.js
4:44:18 PM:  - _api_presentations_list_archived-handler/_api_presentations_list_archived-handler.js
4:44:18 PM:  - _api_presentations_regions-handler/_api_presentations_regions-handler.js
4:44:18 PM:  - _api_presentations_segments-handler/_api_presentations_segments-handler.js
4:44:18 PM:  - _api_presentations_slides_uuid-PARAM-handler/_api_presentations_slides_uuid-PARAM-handler.js
4:44:18 PM:  - _api_presentations_uuid-PARAM-handler/_api_presentations_uuid-PARAM-handler.js
4:44:18 PM:  - _api_presentations_uuid-PARAM_archive-handler/_api_presentations_uuid-PARAM_archive-handler.js
4:44:18 PM:  - _api_presentations_uuid-PARAM_duplicate-handler/_api_presentations_uuid-PARAM_duplicate-handler.js
4:44:18 PM:  - _api_presentations_uuid-PARAM_edit-handler/_api_presentations_uuid-PARAM_edit-handler.js
4:44:18 PM:  - _api_presentations_uuid-PARAM_share-handler/_api_presentations_uuid-PARAM_share-handler.js
4:44:18 PM:  - _api_products_uuid-PARAM-handler/_api_products_uuid-PARAM-handler.js
4:44:18 PM:  - _api_slides_list-handler/_api_slides_list-handler.js
4:44:18 PM:  - _api_slides_list_uuid-PARAM-handler/_api_slides_list_uuid-PARAM-handler.js
4:44:18 PM:  - _api_track-handler/_api_track-handler.js
4:44:18 PM:  - _api_user-handler/_api_user-handler.js
4:44:18 PM:  - _api_user_logout-handler/_api_user_logout-handler.js
4:44:18 PM:  - _ipx/_ipx.js
4:44:18 PM: ​
4:45:23 PM: ​
4:45:23 PM: (Functions bundling completed in 1m 5.7s)
4:45:23 PM: ​
4:45:23 PM: ────────────────────────────────────────────────────────────────
4:45:23 PM:   5. Edge Functions bundling                                    
4:45:23 PM: ────────────────────────────────────────────────────────────────
4:45:23 PM: ​
4:45:23 PM: Packaging Edge Functions from .netlify/edge-functions directory:
4:45:23 PM:  - ipx
4:45:24 PM: ​
4:45:24 PM: (Edge Functions bundling completed in 1.1s)
4:45:24 PM: ​
4:45:24 PM: ────────────────────────────────────────────────────────────────
4:45:24 PM:   6. @netlify/plugin-nextjs (onPostBuild event)                 
4:45:24 PM: ────────────────────────────────────────────────────────────────
4:45:24 PM: ​
4:45:25 PM: Next.js cache saved.
4:45:25 PM: ​
4:45:25 PM: (@netlify/plugin-nextjs onPostBuild completed in 157ms)
4:45:25 PM: ​
4:45:25 PM: ────────────────────────────────────────────────────────────────
4:45:25 PM:   7. Deploy site                                                
4:45:25 PM: ────────────────────────────────────────────────────────────────
4:45:25 PM: ​
4:45:25 PM: Starting to deploy site from '.next'
4:45:25 PM: Creating deploy tree 
4:45:25 PM: Creating deploy upload records
4:45:25 PM: 60 new files to upload
4:45:25 PM: 25 new functions to upload
4:45:44 PM: Site deploy was successfully initiated
4:45:44 PM: ​
4:45:44 PM: (Deploy site completed in 19.7s)
4:45:44 PM: ​
4:45:44 PM: ────────────────────────────────────────────────────────────────
4:45:44 PM:   Netlify Build Complete                                        
4:45:44 PM: ────────────────────────────────────────────────────────────────
4:45:47 PM: Build script success
4:45:49 PM: Uploading Cache of size 700.3MB
4:45:50 PM: Post processing - header rules
4:45:50 PM: Post processing - redirect rules
4:45:50 PM: Post processing done
4:45:54 PM: Finished processing build request in 2m30.167519352s
4:45:54 PM: Site is live ✨

Kind regards
Jes

Trying to bump this.

Ive had no success with calling nested routes under pages/api/
I can call pages/api/users/index.ts, but a call to pages/api/user/list.ts will always immediatly with 500 error, even though they are exactly the same.

When I test locally it works, but when served from netlify it fails.

Do you see any errors in the function console when you see the error? You can check the console from here:

…to get to your deploy-context specific function console.

Make sure to keep the console open before testing it. I tried checking for logs, but didn’t see any, but maybe they appear during realtime logs?

Hi, any news on this? I’m experiencing the exact same problem; a week ago this was not an issue and I haven’t changed any config since.

Also, I’ve tried checking the logs in the function console as @hrishikesh suggested, but there are no logs unfortunately in the function console, not even during build.

(build.command completed in 1m 41.9s)
5:12:26 PM: ​
5:12:26 PM: ────────────────────────────────────────────────────────────────
5:12:26 PM:   3. @netlify/plugin-nextjs (onBuild event)                     
5:12:26 PM: ────────────────────────────────────────────────────────────────
5:12:26 PM: ​
5:12:26 PM: Could not find source file for page /api/contact
5:12:26 PM: Could not find source file for page /api/create-ereceipt
5:12:26 PM: Could not find source file for page /api/receipt-contact
5:12:26 PM: Could not find source file for page /api/upload
5:12:26 PM: Could not find source file for page /api/utils
5:12:26 PM: { functionsDir: '/opt/build/repo/.netlify/functions-internal' }
5:12:26 PM: Patching /opt/build/repo/node_modules/next/dist/server/base-server.js
5:12:26 PM: Done
5:12:26 PM: Patching /opt/build/repo/node_modules/next/dist/server/next-server.js
5:12:26 PM: File was not changed

UPDATE: I’ve looked at the recent changes in @netlify/plugin-nextjs and it seems that the problem happens here, in this function because this is the console log I see in the build (commit 654c6defa99d33de5178409d43827b57a29821d8):

export const getSourceFileForPage = (page: string, root: string) => {
  for (const extension of SOURCE_FILE_EXTENSIONS) {
    const file = join(root, `${page}.${extension}`)
    if (existsSync(file)) {
      return file
    }
  }
  console.log('Could not find source file for page', page)
}

The files are definitely there and I don’t understand how they are not found during the build.

Hi @MadalinaH,

Thanks for adding the info. We’ve let the devs know. However, the only solution meanwhile would be to downgrade to plugin version 4.26.0

2 Likes

Hi hrishikesh,

Downgrading to 4.26.0 has resolved the issue I was having with 500 errors for nested api paths.
Will this thread remain open until the root cause of the issue has been resolved?

Kind regards
Jes

1 Like

Version v.4.28.4 is supposed to resolve this: Release plugin-nextjs: v4.28.4 Β· netlify/next-runtime Β· GitHub, could you please try that?

Thanks, I’ve updated to this version and it works :smile: