Skip to content

[Bug]: Slow TTFB on netlify ? Caching ? #1290

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
1 of 2 tasks
mkubdev opened this issue Apr 1, 2022 · 7 comments
Closed
1 of 2 tasks

[Bug]: Slow TTFB on netlify ? Caching ? #1290

mkubdev opened this issue Apr 1, 2022 · 7 comments
Labels
type: bug code to address defects in shipped code

Comments

@mkubdev
Copy link

mkubdev commented Apr 1, 2022

Summary

It's been 1 month since one of our demo-app wont run on Netlify due to :

{
   errorMessage: "2022-04-01T08:38:00.251Z 446ef97a-e95b-433e-be99-6671e1ac7e17 Task timed out after 10.03 seconds"
}

After multiple searches on the subject, there is still no solution neither on support nor on Github. But i know @ascorbic is really invested on this subject and thank you for this. 🙏

The bug is very strange, it looks like Netlify still struggle slow TTFB...

On Netlify, first request takes more than 10s to querry MongoDB Atlas. (It's a shared cluster Free tier)
image

On Vercel, first request takes 373ms to querry MongoDB Atlas.
image

Same codebase, same release.

Can someone please give us an explanation about why this is happening ?

Please see: #552 #1174
Netlify support: This, or This, or This
StackOverflow: This, or This, or This
Is this can be the explanation ?

Does anyone have a suggestion ?

I know Pro tier allow querry more than 10 secondes. But i would like to know why it's working like a charm on vercel, and not on netlify...

Steps to reproduce

Just take any dummy-sample others folks already share on the support forum on netlify nor github.
It's a private codebase, with a simple prisma querry on the api endpoints : myapp.com/api/annotations

import prisma from '../../lib/prisma'


export default async function handle(req, res) {
  try {
    const annotations = await prisma.annotations.findMany()
    res.json(annotations)
  } catch (error) {
    console.error(error)
  }
}

Ps: I will take time today to build a reproduction repository.

Like others : I haven't any logs on serveless netlify functions.

😶

A link to a reproduction repository

No response

Plugin version

4.3.0

More information about your build

  • I am building using the CLI
  • I am building using file-based configuration (netlify.toml)

What OS are you using?

Windows 10 Pro + WSL2

Your netlify.toml file

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

Your public/_redirects file

`_redirects`
none

Your next.config.js file

`next.config.js`
module.exports = {
  reactStrictMode: true,
}

Builds logs (or link to your logs)

Build logs
4:58:21 PM: Build ready to start
4:58:23 PM: build-image version: 195fbe127e5c374d9c4758652cb62e3b8936a395 (focal)
4:58:23 PM: build-image tag: v4.6.0
4:58:23 PM: buildbot version: 43c70c62bfed821cfaaabbb50f00238dd4bdd2d6
4:58:24 PM: Fetching cached dependencies
4:58:24 PM: Starting to download cache of 647.7MB
4:58:31 PM: Finished downloading cache in 6.988648161s
4:58:31 PM: Starting to extract cache
4:58:52 PM: Finished extracting cache in 21.86013119s
4:58:53 PM: Finished fetching cache in 28.940258455s
4:58:53 PM: Starting to prepare the repo for build
4:58:53 PM: Preparing Git Reference refs/heads/main
4:58:54 PM: Parsing package.json dependencies
4:58:55 PM: Starting build script
4:58:55 PM: Installing dependencies
4:58:55 PM: Python version set to 2.7
4:58:55 PM: Started restoring cached node version
4:58:57 PM: Finished restoring cached node version
4:58:58 PM: v16.14.2 is already installed.
4:58:58 PM: Now using node v16.14.2 (npm v8.5.0)
4:58:58 PM: Started restoring cached build plugins
4:58:58 PM: Finished restoring cached build plugins
4:58:58 PM: Attempting ruby version 2.7.2, read from environment
4:59:00 PM: Using ruby version 2.7.2
4:59:00 PM: Using PHP version 8.0
4:59:00 PM: WARNING: The environment variable 'NODE_ENV' is set to 'production'. Any 'devDependencies' in package.json will not be installed
4:59:00 PM: Started restoring cached yarn cache
4:59:06 PM: Finished restoring cached yarn cache
4:59:06 PM: No yarn workspaces detected
4:59:06 PM: Started restoring cached node modules
4:59:06 PM: Finished restoring cached node modules
4:59:07 PM: Installing NPM modules using Yarn version 1.22.10
4:59:07 PM: yarn install v1.22.10
4:59:08 PM: warning package-lock.json found. Your project contains lock files generated by tools other than Yarn. It is advised not to mix package managers in order to avoid resolution inconsistencies caused by unsynchronized lock files. To clear this warning, remove package-lock.json.
4:59:08 PM: [1/4] Resolving packages...
4:59:12 PM: [2/4] Fetching packages...
4:59:14 PM: info @next/[email protected]: The platform "linux" is incompatible with this module.
4:59:14 PM: info "@next/[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.
4:59:14 PM: info @next/[email protected]: The CPU architecture "x64" is incompatible with this module.
4:59:14 PM: info @next/[email protected]: The platform "linux" is incompatible with this module.
4:59:14 PM: info "@next/[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.
4:59:14 PM: info @next/[email protected]: The CPU architecture "x64" is incompatible with this module.
4:59:14 PM: info @next/[email protected]: The platform "linux" is incompatible with this module.
4:59:14 PM: info "@next/[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.
4:59:14 PM: info @next/[email protected]: The CPU architecture "x64" is incompatible with this module.
4:59:14 PM: info "@next/[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.
4:59:14 PM: info @next/[email protected]: The CPU architecture "x64" is incompatible with this module.
4:59:14 PM: info "@next/[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.
4:59:14 PM: info @next/[email protected]: The platform "linux" is incompatible with this module.
4:59:14 PM: info "@next/[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.
4:59:14 PM: info @next/[email protected]: The CPU architecture "x64" is incompatible with this module.
4:59:14 PM: info @next/[email protected]: The platform "linux" is incompatible with this module.
4:59:14 PM: info "@next/[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.
4:59:14 PM: info @next/[email protected]: The CPU architecture "x64" is incompatible with this module.
4:59:14 PM: info @next/[email protected]: The platform "linux" is incompatible with this module.
4:59:14 PM: info "@next/[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.
4:59:14 PM: info @next/[email protected]: The CPU architecture "x64" is incompatible with this module.
4:59:14 PM: info @next/[email protected]: The platform "linux" is incompatible with this module.
4:59:14 PM: info "@next/[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.
4:59:14 PM: info @next/[email protected]: The CPU architecture "x64" is incompatible with this module.
4:59:14 PM: info "@next/[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.
4:59:14 PM: info [email protected]: The platform "linux" is incompatible with this module.
4:59:14 PM: info "[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.
4:59:14 PM: [3/4] Linking dependencies...
4:59:14 PM: warning "@emotion/styled > @emotion/[email protected]" has unmet peer dependency "@babel/core@^7.0.0".
4:59:14 PM: warning "@emotion/styled > @emotion/babel-plugin > @babel/[email protected]" has unmet peer dependency "@babel/core@^7.0.0-0".
4:59:14 PM: warning " > @material-ui/[email protected]" has unmet peer dependency "@material-ui/core@^4.12.1".
4:59:14 PM: warning "react-spring > @react-spring/[email protected]" has unmet peer dependency "konva@>=2.6".
4:59:14 PM: warning "react-spring > @react-spring/[email protected]" has unmet peer dependency "react-konva@^16.8.0  || ^17.0.0".
4:59:14 PM: warning "react-spring > @react-spring/[email protected]" has unmet peer dependency "react-native@>=0.58".
4:59:14 PM: warning "react-spring > @react-spring/[email protected]" has unmet peer dependency "@react-three/fiber@>=6.0".
4:59:14 PM: warning "react-spring > @react-spring/[email protected]" has unmet peer dependency "three@>=0.126".
4:59:14 PM: warning "react-spring > @react-spring/[email protected]" has unmet peer dependency "react-zdog@>=1.0".
4:59:14 PM: warning "react-spring > @react-spring/[email protected]" has unmet peer dependency "zdog@>=1.0".
4:59:14 PM: warning "eslint-config-next > @typescript-eslint/parser > @typescript-eslint/typescript-estree > [email protected]" has unmet peer dependency "typescript@>=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta".
4:59:20 PM: [4/4] Building fresh packages...
4:59:25 PM: success Saved lockfile.
4:59:25 PM: Done in 17.50s.
4:59:25 PM: NPM modules installed using Yarn
4:59:25 PM: Started restoring cached go cache
4:59:25 PM: Finished restoring cached go cache
4:59:25 PM: go version go1.16.5 linux/amd64
4:59:25 PM: go version go1.16.5 linux/amd64
4:59:25 PM: Installing missing commands
4:59:25 PM: Verify run directory
4:59:27 PM: ​
4:59:27 PM: ────────────────────────────────────────────────────────────────
4:59:27 PM:   Netlify Build                                                 
4:59:27 PM: ────────────────────────────────────────────────────────────────
4:59:27 PM: ​
4:59:27 PM: ❯ Version
4:59:27 PM:   @netlify/build 26.5.1
4:59:27 PM: ​
4:59:27 PM: ❯ Flags
4:59:27 PM:   baseRelDir: true
4:59:27 PM:   buildId: 6241cd0d80245b000807dd9d
4:59:27 PM:   deployId: 6241cd0d80245b000807dd9f
4:59:27 PM: ​
4:59:27 PM: ❯ Current directory
4:59:27 PM:   /opt/build/repo
4:59:27 PM: ​
4:59:27 PM: ❯ Config file
4:59:27 PM:   /opt/build/repo/netlify.toml
4:59:27 PM: ​
4:59:27 PM: ❯ Context
4:59:27 PM:   production
4:59:27 PM: ​
4:59:27 PM: ❯ Loading plugins
4:59:27 PM:    - @netlify/[email protected] from netlify.toml
4:59:29 PM: ​
4:59:29 PM: ────────────────────────────────────────────────────────────────
4:59:29 PM:   1. @netlify/plugin-nextjs (onPreBuild event)                  
4:59:29 PM: ────────────────────────────────────────────────────────────────
4:59:29 PM: ​
4:59:29 PM: Next.js cache restored.
4:59:29 PM: Netlify configuration property "build.environment.NEXT_PRIVATE_TARGET" value changed.
4:59:29 PM: ​
4:59:29 PM: (@netlify/plugin-nextjs onPreBuild completed in 221ms)
4:59:29 PM: ​
4:59:29 PM: ────────────────────────────────────────────────────────────────
4:59:29 PM:   2. Build command from Netlify app                             
4:59:29 PM: ────────────────────────────────────────────────────────────────
4:59:29 PM: ​
4:59:29 PM: $ next build
4:59:30 PM: info  - Loaded env from /opt/build/repo/.env
4:59:30 PM: info  - Checking validity of types...
4:59:30 PM: error - ESLint must be installed in order to run during builds: yarn add --dev eslint
4:59:31 PM: info  - Creating an optimized production build...
5:00:33 PM: info  - Compiled successfully
5:00:33 PM: info  - Collecting page data...
5:00:58 PM: info  - Generating static pages (0/6)
5:00:58 PM: info  - Generating static pages (1/6)
5:00:58 PM: info  - Generating static pages (2/6)
5:00:58 PM: info  - Generating static pages (4/6)
5:00:58 PM: info  - Generating static pages (6/6)
5:00:58 PM: info  - Finalizing page optimization...
5:00:58 PM: Page                                       Size     First Load JS
5:00:58 PM: ┌ ○ /                                      11.2 kB         137 kB
5:00:58 PM: ├   /_app                                  0 B             112 kB
5:00:58 PM: ├ ○ /404                                   192 B           112 kB
5:00:58 PM: ├ λ /api/annotations                       0 B             112 kB
5:00:58 PM: ├ λ /api/annotations/[id]                  0 B             112 kB
5:00:58 PM: ├ λ /api/documents                         0 B             112 kB
5:00:58 PM: ├ λ /api/documents/[id]                    0 B             112 kB
5:00:58 PM: ├ λ /api/hello                             0 B             112 kB
5:00:58 PM: ├ λ /api/version                           0 B             112 kB
5:00:58 PM: ├ ○ /auth/login                            1.81 kB         119 kB
5:00:58 PM: ├ ○ /dashboard                             1.38 kB         136 kB
5:00:58 PM: ├ λ /dashboard/comparison/viewer/[id]      4.55 kB         154 kB
5:00:58 PM: ├ λ /dashboard/pdf-list                    2.69 kB         141 kB
5:00:58 PM: ├ λ /dashboard/pdf-list-compare            2.77 kB         141 kB
5:00:58 PM: ├ ○ /dashboard/viewer                      459 B           146 kB
5:00:58 PM: └ λ /dashboard/viewer/[id]                 2.77 kB         152 kB
5:00:58 PM: + First Load JS shared by all              112 kB
5:00:58 PM:   ├ chunks/framework-5f4595e5518b5600.js   42 kB
5:00:58 PM:   ├ chunks/main-4db07a2bf5ab24b4.js        27.7 kB
5:00:58 PM:   ├ chunks/pages/_app-01e003eb78a50487.js  40.9 kB
5:00:58 PM:   ├ chunks/webpack-5752944655d749a0.js     840 B
5:00:58 PM:   └ css/baa8200a84ef75b3.css               8.82 kB
5:00:58 PM: λ  (Server)  server-side renders at runtime (uses getInitialProps or getServerSideProps)
5:00:58 PM: ○  (Static)  automatically rendered as static HTML (uses no initial props)
5:00:59 PM: ​
5:00:59 PM: (build.command completed in 1m 29.4s)
5:00:59 PM: ​
5:00:59 PM: ────────────────────────────────────────────────────────────────
5:00:59 PM:   3. @netlify/plugin-nextjs (onBuild event)                     
5:00:59 PM: ────────────────────────────────────────────────────────────────
5:00:59 PM: ​
5:00:59 PM: Patching /opt/build/repo/node_modules/next/dist/server/base-server.js
5:00:59 PM: Done
5:00:59 PM: Moving static page files to serve from CDN...
5:00:59 PM: Moved 4 files
5:00:59 PM: Netlify configuration property "redirects" value changed to [
5:00:59 PM:   { from: '/_next/static/*', to: '/static/:splat', status: 200 },
5:00:59 PM:   {
5:00:59 PM:     from: '/_next/image*',
5:00:59 PM:     query: { url: ':url', w: ':width', q: ':quality' },
5:00:59 PM:     to: '/_ipx/w_:width,q_:quality/:url',
5:00:59 PM:     status: 301
5:00:59 PM:   },
5:00:59 PM:   { from: '/_ipx/*', to: '/.netlify/builders/_ipx', status: 200 },
5:00:59 PM:   { from: '/cache/*', to: '/404.html', status: 404, force: true },
5:00:59 PM:   { from: '/server/*', to: '/404.html', status: 404, force: true },
5:00:59 PM:   { from: '/serverless/*', to: '/404.html', status: 404, force: true },
5:00:59 PM:   { from: '/trace', to: '/404.html', status: 404, force: true },
5:00:59 PM:   { from: '/traces', to: '/404.html', status: 404, force: true },
5:00:59 PM:   {
5:00:59 PM:     from: '/routes-manifest.json',
5:00:59 PM:     to: '/404.html',
5:00:59 PM:     status: 404,
5:00:59 PM:     force: true
5:00:59 PM:   },
5:00:59 PM:   {
5:00:59 PM:     from: '/build-manifest.json',
5:00:59 PM:     to: '/404.html',
5:00:59 PM:     status: 404,
5:00:59 PM:     force: true
5:00:59 PM:   },
5:00:59 PM:   {
5:00:59 PM:     from: '/prerender-manifest.json',
5:00:59 PM:     to: '/404.html',
5:00:59 PM:     status: 404,
5:00:59 PM:     force: true
5:00:59 PM:   },
5:00:59 PM:   {
5:00:59 PM:     from: '/react-loadable-manifest.json',
5:00:59 PM:     to: '/404.html',
5:00:59 PM:     status: 404,
5:00:59 PM:     force: true
5:00:59 PM:   },
5:00:59 PM:   { from: '/BUILD_ID', to: '/404.html', status: 404, force: true },
5:00:59 PM:   {
5:00:59 PM:     from: '/api',
5:00:59 PM:     to: '/.netlify/functions/___netlify-handler',
5:00:59 PM:     status: 200
5:00:59 PM:   },
5:00:59 PM:   {
5:00:59 PM:     from: '/api/*',
5:00:59 PM:     to: '/.netlify/functions/___netlify-handler',
5:00:59 PM:     status: 200
5:00:59 PM:   },
5:00:59 PM:   {
5:00:59 PM:     from: '/favicon.ico',
5:00:59 PM:     to: '/favicon.ico',
5:00:59 PM:     conditions: { Cookie: [Array] },
5:00:59 PM:     status: 200
5:00:59 PM:   },
5:00:59 PM:   {
5:00:59 PM:     from: '/hero.svg',
5:00:59 PM:     to: '/hero.svg',
5:00:59 PM:     conditions: { Cookie: [Array] },
5:00:59 PM:     status: 200
5:00:59 PM:   },
5:00:59 PM:   {
5:00:59 PM:     from: '/logo_TFTLabs.png',
5:00:59 PM:     to: '/logo_TFTLabs.png',
5:00:59 PM:     conditions: { Cookie: [Array] },
5:00:59 PM:     status: 200
5:00:59 PM:   },
5:00:59 PM:   {
5:00:59 PM:     from: '/user.png',
5:00:59 PM:     to: '/user.png',
5:00:59 PM:     conditions: { Cookie: [Array] },
5:00:59 PM:     status: 200
5:00:59 PM:   },
5:00:59 PM:   {
5:00:59 PM:     from: '/vercel.svg',
5:00:59 PM:     to: '/vercel.svg',
5:00:59 PM:     conditions: { Cookie: [Array] },
5:00:59 PM:     status: 200
5:00:59 PM:   },
5:00:59 PM:   {
5:00:59 PM:     from: '/wv-lifecycle.png',
5:00:59 PM:     to: '/wv-lifecycle.png',
5:00:59 PM:     conditions: { Cookie: [Array] },
5:00:59 PM:     status: 200
5:00:59 PM:   },
5:00:59 PM:   {
5:00:59 PM:     from: '/*',
5:00:59 PM:     to: '/.netlify/functions/___netlify-handler',
5:00:59 PM:     status: 200,
5:00:59 PM:     conditions: { Cookie: [Array] },
5:00:59 PM:     force: true
5:00:59 PM:   },
5:00:59 PM:   {
5:00:59 PM:     from: '/_next/data/6Hc2sR75wXTds1i__paMH/index.json',
5:00:59 PM:     to: '/.netlify/functions/___netlify-handler',
5:00:59 PM:     status: 200,
5:00:59 PM:     force: false
5:00:59 PM:   },
5:00:59 PM:   {
5:00:59 PM:     from: '/',
5:00:59 PM:     to: '/.netlify/functions/___netlify-handler',
5:00:59 PM:     status: 200,
5:00:59 PM:     force: false
5:00:59 PM:   },
5:00:59 PM:   {
5:00:59 PM:     from: '/_next/data/6Hc2sR75wXTds1i__paMH/auth/login.json',
5:00:59 PM:     to: '/.netlify/functions/___netlify-handler',
5:00:59 PM:     status: 200,
5:00:59 PM:     force: false
5:00:59 PM:   },
5:00:59 PM:   {
5:00:59 PM:     from: '/auth/login',
5:00:59 PM:     to: '/.netlify/functions/___netlify-handler',
5:00:59 PM:     status: 200,
5:00:59 PM:     force: false
5:00:59 PM:   },
5:00:59 PM:   {
5:00:59 PM:     from: '/_next/data/6Hc2sR75wXTds1i__paMH/dashboard.json',
5:00:59 PM:     to: '/.netlify/functions/___netlify-handler',
5:00:59 PM:     status: 200,
5:00:59 PM:     force: false
5:00:59 PM:   },
5:00:59 PM:   {
5:00:59 PM:     from: '/dashboard',
5:00:59 PM:     to: '/.netlify/functions/___netlify-handler',
5:00:59 PM:     status: 200,
5:00:59 PM:     force: false
5:00:59 PM:   },
5:00:59 PM:   {
5:00:59 PM:     from: '/_next/data/6Hc2sR75wXTds1i__paMH/dashboard/pdf-list.json',
5:00:59 PM:     to: '/.netlify/functions/___netlify-handler',
5:00:59 PM:     status: 200,
5:00:59 PM:     force: false
5:00:59 PM:   },
5:00:59 PM:   {
5:00:59 PM:     from: '/dashboard/pdf-list',
5:00:59 PM:     to: '/.netlify/functions/___netlify-handler',
5:00:59 PM:     status: 200,
5:00:59 PM:     force: false
5:00:59 PM:   },
5:00:59 PM:   {
5:00:59 PM:     from: '/_next/data/6Hc2sR75wXTds1i__paMH/dashboard/pdf-list-compare.json',
5:00:59 PM:     to: '/.netlify/functions/___netlify-handler',
5:00:59 PM:     status: 200,
5:00:59 PM:     force: false
5:00:59 PM:   },
5:00:59 PM:   {
5:00:59 PM:     from: '/dashboard/pdf-list-compare',
5:00:59 PM:     to: '/.netlify/functions/___netlify-handler',
5:00:59 PM:     status: 200,
5:00:59 PM:     force: false
5:00:59 PM:   },
5:00:59 PM:   {
5:00:59 PM:     from: '/_next/data/6Hc2sR75wXTds1i__paMH/dashboard/viewer.json',
5:00:59 PM:     to: '/.netlify/functions/___netlify-handler',
5:00:59 PM:     status: 200,
5:00:59 PM:     force: false
5:00:59 PM:   },
5:00:59 PM:   {
5:00:59 PM:     from: '/dashboard/viewer',
5:00:59 PM:     to: '/.netlify/functions/___netlify-handler',
5:00:59 PM:     status: 200,
5:00:59 PM:     force: false
5:00:59 PM:   },
5:00:59 PM:   {
5:00:59 PM:     from: '/_next/data/6Hc2sR75wXTds1i__paMH/dashboard/comparison/viewer/:id.json',
5:00:59 PM:     to: '/.netlify/functions/___netlify-handler',
5:00:59 PM:     status: 200,
5:00:59 PM:     force: false
5:00:59 PM:   },
5:00:59 PM:   {
5:00:59 PM:     from: '/dashboard/comparison/viewer/:id',
5:00:59 PM:     to: '/.netlify/functions/___netlify-handler',
5:00:59 PM:     status: 200,
5:00:59 PM:     force: false
5:00:59 PM:   },
5:00:59 PM:   {
5:00:59 PM:     from: '/_next/data/6Hc2sR75wXTds1i__paMH/dashboard/viewer/:id.json',
5:00:59 PM:     to: '/.netlify/functions/___netlify-handler',
5:00:59 PM:     status: 200,
5:00:59 PM:     force: false
5:00:59 PM:   },
5:00:59 PM:   {
5:00:59 PM:     from: '/dashboard/viewer/:id',
5:00:59 PM:     to: '/.netlify/functions/___netlify-handler',
5:00:59 PM:     status: 200,
5:00:59 PM:     force: false
5:00:59 PM:   },
5:00:59 PM:   {
5:00:59 PM:     from: '/*',
5:00:59 PM:     to: '/.netlify/functions/___netlify-handler',
5:00:59 PM:     status: 200
5:00:59 PM:   }
5:00:59 PM: ].
5:00:59 PM: ​
5:00:59 PM: (@netlify/plugin-nextjs onBuild completed in 93ms)
5:00:59 PM: ​
5:00:59 PM: ────────────────────────────────────────────────────────────────
5:00:59 PM:   4. Functions bundling                                         
5:00:59 PM: ────────────────────────────────────────────────────────────────
5:00:59 PM: ​
5:00:59 PM: Packaging Functions from .netlify/functions-internal directory:
5:00:59 PM:  - ___netlify-handler/___netlify-handler.js
5:00:59 PM:  - ___netlify-odb-handler/___netlify-odb-handler.js
5:00:59 PM:  - _ipx/_ipx.js
5:00:59 PM: ​
5:02:57 PM: ​
5:02:57 PM: (Functions bundling completed in 1m 58.6s)
5:02:57 PM: ​
5:02:57 PM: ────────────────────────────────────────────────────────────────
5:02:57 PM:   5. @netlify/plugin-nextjs (onPostBuild event)                 
5:02:57 PM: ────────────────────────────────────────────────────────────────
5:02:57 PM: ​
5:02:58 PM: Next.js cache saved.
5:02:58 PM: ​
5:02:58 PM: (@netlify/plugin-nextjs onPostBuild completed in 616ms)
5:02:58 PM: ​
5:02:58 PM: ────────────────────────────────────────────────────────────────
5:02:58 PM:   6. Deploy site                                                
5:02:58 PM: ────────────────────────────────────────────────────────────────
5:02:58 PM: ​
5:02:58 PM: Starting to deploy site from '.next'
5:02:59 PM: Creating deploy tree 
5:02:59 PM: Creating deploy upload records
5:02:59 PM: 30 new files to upload
5:02:59 PM: 3 new functions to upload
5:03:12 PM: Site deploy was successfully initiated
5:03:12 PM: ​
5:03:12 PM: (Deploy site completed in 13.6s)
5:03:12 PM: ​
5:03:12 PM: ────────────────────────────────────────────────────────────────
5:03:12 PM:   Netlify Build Complete                                        
5:03:12 PM: ────────────────────────────────────────────────────────────────
5:03:12 PM: ​
5:03:12 PM: Starting post processing
5:03:12 PM: (Netlify Build completed in 3m 44.8s)
5:03:12 PM: Post processing - HTML
5:03:12 PM: Caching artifacts
5:03:12 PM: Started saving node modules
5:03:12 PM: Finished saving node modules
5:03:12 PM: Started saving build plugins
5:03:12 PM: Finished saving build plugins
5:03:12 PM: Started saving yarn cache
5:03:13 PM: Post processing - header rules
5:03:14 PM: Post processing - redirect rules
5:03:14 PM: Post processing done
5:03:17 PM: Site is live ✨
5:03:19 PM: Finished saving yarn cache
5:03:19 PM: Started saving pip cache
5:03:19 PM: Finished saving pip cache
5:03:19 PM: Started saving emacs cask dependencies
5:03:19 PM: Finished saving emacs cask dependencies
5:03:19 PM: Started saving maven dependencies
5:03:19 PM: Finished saving maven dependencies
5:03:19 PM: Started saving boot dependencies
5:03:19 PM: Finished saving boot dependencies
5:03:19 PM: Started saving rust rustup cache
5:03:19 PM: Finished saving rust rustup cache
5:03:19 PM: Started saving go dependencies
5:03:19 PM: Finished saving go dependencies
5:03:19 PM: Build script success
5:05:09 PM: Finished processing build request in 6m45.406974931s

Function logs

Function logs
NONE

.next JSON files

generated .next JSON files
  • required-server-files.json:
{"version":1,"config":{"env":{},"webpack":null,"webpackDevMiddleware":null,"eslint":{"ignoreDuringBuilds":false},"typescript":{"ignoreBuildErrors":false,"tsconfigPath":"tsconfig.json"},"distDir":".next","cleanDistDir":true,"assetPrefix":"","configOrigin":"next.config.js","useFileSystemPublicRoutes":true,"generateEtags":true,"pageExtensions":["tsx","ts","jsx","js"],"target":"server","poweredByHeader":true,"compress":true,"analyticsId":"","images":{"deviceSizes":[640,750,828,1080,1200,1920,2048,3840],"imageSizes":[16,32,48,64,96,128,256,384],"path":"/_next/image","loader":"default","domains":[],"disableStaticImages":false,"minimumCacheTTL":60,"formats":["image/webp"],"dangerouslyAllowSVG":false,"contentSecurityPolicy":"script-src 'none'; frame-src 'none'; sandbox;"},"devIndicators":{"buildActivity":true,"buildActivityPosition":"bottom-right"},"onDemandEntries":{"maxInactiveAge":15000,"pagesBufferLength":2},"amp":{"canonicalBase":""},"basePath":"","sassOptions":{},"trailingSlash":false,"i18n":null,"productionBrowserSourceMaps":false,"optimizeFonts":true,"excludeDefaultMomentLocales":true,"serverRuntimeConfig":{},"publicRuntimeConfig":{},"reactStrictMode":true,"httpAgentOptions":{"keepAlive":true},"outputFileTracing":true,"staticPageGenerationTimeout":60,"swcMinify":false,"experimental":{"cpus":1,"sharedPool":true,"plugins":false,"profiling":false,"isrFlushToDisk":true,"workerThreads":false,"pageEnv":false,"optimizeCss":false,"scrollRestoration":false,"externalDir":false,"reactRoot":false,"disableOptimizedLoading":false,"gzipSize":true,"swcFileReading":true,"craCompat":false,"esmExternals":true,"isrMemoryCacheSize":52428800,"serverComponents":false,"fullySpecified":false,"outputFileTracingRoot":"","outputStandalone":false,"trustHostHeader":false},"configFileName":"next.config.js"},"appDir":"/home/mkubik/dev/00.webapp/tftpdf-demo","files":[".next/routes-manifest.json",".next/server/pages-manifest.json",".next/build-manifest.json",".next/prerender-manifest.json",".next/server/middleware-manifest.json",".next/react-loadable-manifest.json",".next/server/font-manifest.json",".next/BUILD_ID"],"ignore":["node_modules/next/dist/compiled/@ampproject/toolbox-optimizer/**/*"]}
  • routes-manifest.json:
{"version":3,"pages404":true,"basePath":"","redirects":[{"source":"/:path+/","destination":"/:path+","internal":true,"statusCode":308,"regex":"^(?:/((?:[^/]+?)(?:/(?:[^/]+?))*))/$"}],"headers":[],"dynamicRoutes":[{"page":"/api/annotations/[id]","regex":"^/api/annotations/([^/]+?)(?:/)?$","routeKeys":{"id":"id"},"namedRegex":"^/api/annotations/(?<id>[^/]+?)(?:/)?$"},{"page":"/api/documents/[id]","regex":"^/api/documents/([^/]+?)(?:/)?$","routeKeys":{"id":"id"},"namedRegex":"^/api/documents/(?<id>[^/]+?)(?:/)?$"},{"page":"/dashboard/comparison/viewer/[id]","regex":"^/dashboard/comparison/viewer/([^/]+?)(?:/)?$","routeKeys":{"id":"id"},"namedRegex":"^/dashboard/comparison/viewer/(?<id>[^/]+?)(?:/)?$"},{"page":"/dashboard/viewer/[id]","regex":"^/dashboard/viewer/([^/]+?)(?:/)?$","routeKeys":{"id":"id"},"namedRegex":"^/dashboard/viewer/(?<id>[^/]+?)(?:/)?$"}],"staticRoutes":[{"page":"/","regex":"^/(?:/)?$","routeKeys":{},"namedRegex":"^/(?:/)?$"},{"page":"/auth/login","regex":"^/auth/login(?:/)?$","routeKeys":{},"namedRegex":"^/auth/login(?:/)?$"},{"page":"/dashboard","regex":"^/dashboard(?:/)?$","routeKeys":{},"namedRegex":"^/dashboard(?:/)?$"},{"page":"/dashboard/pdf-list","regex":"^/dashboard/pdf\\-list(?:/)?$","routeKeys":{},"namedRegex":"^/dashboard/pdf\\-list(?:/)?$"},{"page":"/dashboard/pdf-list-compare","regex":"^/dashboard/pdf\\-list\\-compare(?:/)?$","routeKeys":{},"namedRegex":"^/dashboard/pdf\\-list\\-compare(?:/)?$"},{"page":"/dashboard/viewer","regex":"^/dashboard/viewer(?:/)?$","routeKeys":{},"namedRegex":"^/dashboard/viewer(?:/)?$"}],"dataRoutes":[{"page":"/dashboard/comparison/viewer/[id]","routeKeys":{"id":"id"},"dataRouteRegex":"^/_next/data/fSutAE9_OsQrwouEKfEmz/dashboard/comparison/viewer/([^/]+?)\\.json$","namedDataRouteRegex":"^/_next/data/fSutAE9_OsQrwouEKfEmz/dashboard/comparison/viewer/(?<id>[^/]+?)\\.json$"},{"page":"/dashboard/pdf-list","dataRouteRegex":"^/_next/data/fSutAE9_OsQrwouEKfEmz/dashboard/pdf-list.json$"},{"page":"/dashboard/pdf-list-compare","dataRouteRegex":"^/_next/data/fSutAE9_OsQrwouEKfEmz/dashboard/pdf-list-compare.json$"},{"page":"/dashboard/viewer/[id]","routeKeys":{"id":"id"},"dataRouteRegex":"^/_next/data/fSutAE9_OsQrwouEKfEmz/dashboard/viewer/([^/]+?)\\.json$","namedDataRouteRegex":"^/_next/data/fSutAE9_OsQrwouEKfEmz/dashboard/viewer/(?<id>[^/]+?)\\.json$"}],"rewrites":[]}
  • prerender-manifest.json:
{"version":3,"routes":{},"dynamicRoutes":{},"preview":{"previewModeId":"25b66e6458b63c1a5cd9a95abff594c1","previewModeSigningKey":"bca0b2ecdbf049420acd6f0b8c9550d89a9d49623a1482becddf3788c84570b2","previewModeEncryptionKey":"ed77fc031fc1ddcdfed28c7d12193fb3e0454a7add40046f94c44e9851285d5c"},"notFoundRoutes":[]}
@mkubdev mkubdev added the type: bug code to address defects in shipped code label Apr 1, 2022
@ascorbic
Copy link
Contributor

ascorbic commented Apr 1, 2022

Hi @mkubdev
I can assure you that this isn't something we're doing on purpose! We're trying really hard to work out why it's happening, but have been having real trouble getting a working reproduction because all of the reports are from people using databases or other APIs that we don't have access to. I'm not sure why you say there's been no response from Netlify, when you can see I have been very active in the issues. I'm going to close this as a duplicate of #1174. If you are able to provide a reproduction in there then it would be very useful.

@ascorbic ascorbic closed this as completed Apr 1, 2022
@mkubdev
Copy link
Author

mkubdev commented Apr 1, 2022

Hi @ascorbic
Sorry for the wrong term used, I didn't mean to imply that Netlify was doing this on purpose. But that there is something going on between Netlify and Vercel (vercel as the creator of nextjs).

I forked a piece of our project, and build it on netlify, the issue is here.

This is the netlify website: https://classy-naiad-a01562.netlify.app/api/annotations
Based on this repository: https://github.com/mkubdev/netlify-timedout

I hope this can help the issue. Don't hesitate to ask me any questions and i'll provide any informations i can to help.

@mkubdev mkubdev changed the title [Bug]: Slow TTFB on purpose ? Caching ? [Bug]: Slow TTFB on netlify ? Caching ? Apr 1, 2022
@ascorbic
Copy link
Contributor

ascorbic commented Apr 1, 2022

Thanks for the repro. Does that repo need any API keys or anything, or should I be able to fork it and deploy it myself?

@opennextjs opennextjs deleted a comment from mkubdev Apr 1, 2022
@ascorbic
Copy link
Contributor

ascorbic commented Apr 1, 2022

I deleted your comment now I have the creds, thanks.

@mkubdev
Copy link
Author

mkubdev commented Apr 1, 2022

I would like to add that the vercel screenshot is wrong.

The first TTFB on vercel is ~8s, then ~500ms :
image

@ascorbic
Copy link
Contributor

ascorbic commented Apr 4, 2022

After many hours of testing, it seems the cause isn't prisma after all. It's Material UI! Removing the import import { ConstructionOutlined } from "@mui/icons-material"; from stores/annotationSlice.js removes almost all of the delay. What I'm not sure about it why it's not using the require cache between requests, and every load is a similar time

@mkubdev
Copy link
Author

mkubdev commented Apr 5, 2022

HI @ascorbic ! I can confirm that removing import { ConstructionOutlined } from "@mui/icons-material"; solve the issue !
We use @heroicon now instead of material-ui, the stores/annotationSlice.js material-ui import was not even used..

Thank you for hours of testing, even better if it can help the community. Have a great day ! ✨

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug code to address defects in shipped code
Projects
None yet
Development

No branches or pull requests

2 participants