oleeskild / obsidian-digital-garden

MIT License
1.43k stars 130 forks source link

Large images cause Netlify compilation failure only if placed in or directly after a callout block #107

Closed jaalte closed 1 year ago

jaalte commented 2 years ago

I've tried it with other images and haven't had issues with it. I think it's likely happening in multiple places in my vault with different images, but this is the first one I've been able to isolate. I'll probably be able to sift through all the compilation errors one by one until my whole vault works, but I'm posting this to leave a record of the bug.

Quirks:
The error
5:32:44 AM: Failed during stage 'building site': Build script returned non-zero exit code: 2 (https://ntl.fyi/exit-code-2)
5:32:43 AM: [11ty] Problem writing Eleventy templates: (more in DEBUG output)
5:32:43 AM: [11ty] > Having trouble writing template: dist/unsorted/bug-test/index.html
5:32:43 AM: `TemplateWriterWriteError` was thrown
5:32:43 AM: [11ty] > Maximum call stack size exceeded
5:32:43 AM: `RangeError` was thrown:
5:32:43 AM: [11ty]     RangeError: Maximum call stack size exceeded
5:32:43 AM:         at String.replace (<anonymous>)
5:32:43 AM:         at Object.<anonymous> (/opt/build/repo/.eleventy.js:162:27)
5:32:43 AM:         at Template.runTransforms (/opt/build/repo/node_modules/@11ty/eleventy/src/Template.js:553:38)
5:32:43 AM:         at Template.renderPageEntry (/opt/build/repo/node_modules/@11ty/eleventy/src/Template.js:848:26)
5:32:43 AM:         at processTicksAndRejections (node:internal/process/task_queues:96:5)
5:32:43 AM:         at async /opt/build/repo/node_modules/@11ty/eleventy/src/Template.js:872:21
5:32:43 AM:         at async Promise.all (index 0)
5:32:43 AM: [11ty] Copied 1 file / Wrote 0 files in 7.97 seconds (v1.0.0)
5:32:44 AM: ERROR: "build:eleventy" exited with 1.

Doesn't seem like it's caused by a loop, just the stack getting too tall. Maybe the code for rendering callouts bounces between too many functions, causing the code that converts images into data to exceed the limit.

I've attached my bug test markdown file along with the image Bug test.md rosehip.png

Full error log
5:32:16 AM: build-image version: 4c0c1cadee6a31c9bb8d824514030009c4c05c6a (focal)
5:32:16 AM: build-image tag: v4.15.0
5:32:16 AM: buildbot version: 44377b3b6a4027dd8a09c3df7d29646ce9192423
5:32:16 AM: Fetching cached dependencies
5:32:16 AM: Starting to download cache of 354.4MB
5:32:18 AM: Finished downloading cache in 1.860484372s
5:32:18 AM: Starting to extract cache
5:32:19 AM: Finished extracting cache in 1.171114654s
5:32:19 AM: Finished fetching cache in 3.091641763s
5:32:19 AM: Starting to prepare the repo for build
5:32:20 AM: Preparing Git Reference refs/heads/main
5:32:22 AM: Parsing package.json dependencies
5:32:23 AM: Different build command detected, going to use the one specified in the Netlify configuration file: 'npm install && npm run build' versus '' in the Netlify UI
5:32:23 AM: Section completed: initializing
5:32:23 AM: Starting build script
5:32:23 AM: Installing dependencies
5:32:23 AM: Python version set to 2.7
5:32:23 AM: Started restoring cached node version
5:32:24 AM: Finished restoring cached node version
5:32:24 AM: v16.18.1 is already installed.
5:32:24 AM: Now using node v16.18.1 (npm v8.19.2)
5:32:24 AM: Enabling node corepack
5:32:24 AM: Started restoring cached build plugins
5:32:24 AM: Finished restoring cached build plugins
5:32:24 AM: Attempting ruby version 2.7.2, read from environment
5:32:25 AM: Using ruby version 2.7.2
5:32:25 AM: Using PHP version 8.0
5:32:25 AM: No npm workspaces detected
5:32:25 AM: Started restoring cached node modules
5:32:25 AM: Finished restoring cached node modules
5:32:26 AM: Started restoring cached go cache
5:32:26 AM: Finished restoring cached go cache
5:32:27 AM: Installing Go version 1.19.3 (requested 1.19.x)
5:32:31 AM: unset GOOS;
5:32:31 AM: unset GOARCH;
5:32:31 AM: export GOROOT='/opt/buildhome/.gimme/versions/go1.19.3.linux.amd64';
5:32:31 AM: export PATH="/opt/buildhome/.gimme/versions/go1.19.3.linux.amd64/bin:${PATH}";
5:32:31 AM: go version >&2;
5:32:31 AM: export GIMME_ENV="/opt/buildhome/.gimme/env/go1.19.3.linux.amd64.env"
5:32:31 AM: go version go1.19.3 linux/amd64
5:32:32 AM: Detected 1 framework(s)
5:32:32 AM: "eleventy" at version "1.0.0"
5:32:32 AM: Installing missing commands
5:32:32 AM: Verify run directory
5:32:33 AM: ​
5:32:33 AM: ────────────────────────────────────────────────────────────────
5:32:33 AM:   Netlify Build                                                 
5:32:33 AM: ────────────────────────────────────────────────────────────────
5:32:33 AM: ​
5:32:33 AM: ❯ Version
5:32:33 AM:   @netlify/build 28.4.0
5:32:33 AM: ​
5:32:33 AM: ❯ Flags
5:32:33 AM:   baseRelDir: true
5:32:33 AM:   buildId: 637f01dfc5a1f6000995468e
5:32:33 AM:   deployId: 637f01dfc5a1f60009954690
5:32:33 AM: ​
5:32:33 AM: ❯ Current directory
5:32:33 AM:   /opt/build/repo
5:32:33 AM: ​
5:32:33 AM: ❯ Config file
5:32:33 AM:   /opt/build/repo/netlify.toml
5:32:33 AM: ​
5:32:33 AM: ❯ Context
5:32:33 AM:   production
5:32:33 AM: ​
5:32:33 AM: ────────────────────────────────────────────────────────────────
5:32:33 AM:   1. build.command from netlify.toml                            
5:32:33 AM: ────────────────────────────────────────────────────────────────
5:32:33 AM: ​
5:32:33 AM: $ npm install && npm run build
5:32:34 AM: up to date, audited 605 packages in 1s
5:32:34 AM: 71 packages are looking for funding
5:32:34 AM:   run `npm fund` for details
5:32:34 AM: 9 vulnerabilities (4 moderate, 4 high, 1 critical)
5:32:34 AM: To address issues that do not require attention, run:
5:32:34 AM:   npm audit fix
5:32:34 AM: Some issues need review, and may require choosing
5:32:34 AM: a different dependency.
5:32:34 AM: Run `npm audit` for details.
5:32:35 AM: > web@1.0.0 build
5:32:35 AM: > npm-run-all build:*
5:32:35 AM: > web@1.0.0 build:eleventy
5:32:35 AM: > cross-env ELEVENTY_ENV=prod NODE_OPTIONS=--max-old-space-size=4096 eleventy
5:32:43 AM: [11ty] Writing dist/404/index.html from ./src/site/404.njk
5:32:43 AM: [11ty] Writing netlify/functions/search/data.json from ./src/site/lunr.njk
5:32:43 AM: [11ty] Writing dist/how-to-use-this-nightmare-software/index.html from ./src/site/notes/How to use this nightmare software.md (njk)
5:32:43 AM: [11ty] Writing dist/unsorted/ethnobotany/index.html from ./src/site/notes/Unsorted/Ethnobotany.md (njk)
5:32:43 AM: [11ty] Writing dist/unsorted/hort-110/index.html from ./src/site/notes/Unsorted/HORT-110.md (njk)
5:32:43 AM: [11ty] Writing dist/unsorted/hort-notes-plant-tissues/index.html from ./src/site/notes/Unsorted/Hort Notes - Plant Tissues.md (njk)
5:32:43 AM: [11ty] Writing dist/unsorted/hort-notes-roots-stems-and-foliage/index.html from ./src/site/notes/Unsorted/Hort Notes - Roots, Stems, and Foliage.md (njk)
5:32:43 AM: [11ty] Writing dist/unsorted/plant-anatomy/index.html from ./src/site/notes/Unsorted/Plant Anatomy.md (njk)
5:32:43 AM: [11ty] Writing dist/unsorted/plant-communication/index.html from ./src/site/notes/Unsorted/Plant communication.md (njk)
5:32:43 AM: [11ty] Writing dist/unsorted/plant-cultivation-hub/index.html from ./src/site/notes/Unsorted/Plant cultivation hub.md (njk)
5:32:43 AM: [11ty] Writing dist/unsorted/plants/index.html from ./src/site/notes/Unsorted/Plants.md (njk)
5:32:43 AM: [11ty] Writing dist/index.html from ./src/site/index.njk
5:32:43 AM: [11ty] Writing dist/unsorted/types-of-plants/index.html from ./src/site/notes/Unsorted/Types of Plants.md (njk)
5:32:43 AM: [11ty] Writing dist/unsorted/digital-garden-hub/index.html from ./src/site/notes/Unsorted/Digital Garden Hub.md (njk)
5:32:43 AM: [11ty] Writing dist/unsorted/hort-notes-plant-cells/index.html from ./src/site/notes/Unsorted/Hort Notes - Plant Cells.md (njk)
5:32:43 AM: [11ty] Writing dist/unsorted/hort-notes-roots/index.html from ./src/site/notes/Unsorted/Hort Notes - Roots.md (njk)
5:32:44 AM: Creating deploy upload records
5:32:43 AM: [11ty] Writing dist/unsorted/plant-hormones/index.html from ./src/site/notes/Unsorted/Plant hormones.md (njk)
5:32:43 AM: [11ty] Writing dist/class-horticulture/plant-reproduction/index.html from ./src/site/notes/Class - Horticulture/Plant reproduction.md (njk)
5:32:43 AM: [11ty] Writing dist/unsorted/plant-morphology-fruit/index.html from ./src/site/notes/Unsorted/Plant morphology - Fruit.md (njk)
5:32:43 AM: [11ty] Writing dist/unsorted/plant-illnesses/index.html from ./src/site/notes/Unsorted/Plant illnesses.md (njk)
5:32:44 AM: Failed during stage 'building site': Build script returned non-zero exit code: 2 (https://ntl.fyi/exit-code-2)
5:32:43 AM: [11ty] Problem writing Eleventy templates: (more in DEBUG output)
5:32:43 AM: [11ty] > Having trouble writing template: dist/unsorted/bug-test/index.html
5:32:43 AM: `TemplateWriterWriteError` was thrown
5:32:43 AM: [11ty] > Maximum call stack size exceeded
5:32:43 AM: `RangeError` was thrown:
5:32:43 AM: [11ty]     RangeError: Maximum call stack size exceeded
5:32:43 AM:         at String.replace (<anonymous>)
5:32:43 AM:         at Object.<anonymous> (/opt/build/repo/.eleventy.js:162:27)
5:32:43 AM:         at Template.runTransforms (/opt/build/repo/node_modules/@11ty/eleventy/src/Template.js:553:38)
5:32:43 AM:         at Template.renderPageEntry (/opt/build/repo/node_modules/@11ty/eleventy/src/Template.js:848:26)
5:32:43 AM:         at processTicksAndRejections (node:internal/process/task_queues:96:5)
5:32:43 AM:         at async /opt/build/repo/node_modules/@11ty/eleventy/src/Template.js:872:21
5:32:43 AM:         at async Promise.all (index 0)
5:32:43 AM: [11ty] Copied 1 file / Wrote 0 files in 7.97 seconds (v1.0.0)
5:32:44 AM: ERROR: "build:eleventy" exited with 1.
5:32:44 AM: ​
5:32:44 AM: ────────────────────────────────────────────────────────────────
5:32:44 AM:   "build.command" failed                                        
5:32:44 AM: ────────────────────────────────────────────────────────────────
5:32:44 AM: ​
5:32:44 AM:   Error message
5:32:44 AM:   Command failed with exit code 1: npm install && npm run build (https://ntl.fyi/exit-code-1)
5:32:44 AM: ​
5:32:44 AM:   Error location
5:32:44 AM:   In build.command from netlify.toml:
5:32:44 AM:   npm install && npm run build
5:32:44 AM: ​
5:32:44 AM:   Resolved config
5:32:44 AM:   build:
5:32:44 AM:     command: npm install && npm run build
5:32:44 AM:     commandOrigin: config
5:32:44 AM:     publish: /opt/build/repo/dist
5:32:44 AM:     publishOrigin: config
5:32:44 AM:   functionsDirectory: /opt/build/repo/netlify/functions
5:32:44 AM:   redirects:
5:32:44 AM:     - from: /api/*      status: 200      to: /.netlify/functions/:splat    - from: /*      status: 404      to: /404  redirectsOrigin: configCaching artifacts
5:32:44 AM: Started saving node modules
5:32:44 AM: Finished saving node modules
5:32:44 AM: Started saving build plugins
5:32:44 AM: Finished saving build plugins
5:32:44 AM: Started saving pip cache
5:32:44 AM: Finished saving pip cache
5:32:44 AM: Started saving emacs cask dependencies
5:32:44 AM: Finished saving emacs cask dependencies
5:32:44 AM: Started saving maven dependencies
5:32:44 AM: Finished saving maven dependencies
5:32:44 AM: Started saving boot dependencies
5:32:44 AM: Finished saving boot dependencies
5:32:44 AM: Started saving rust rustup cache
5:32:44 AM: Finished saving rust rustup cache
5:32:44 AM: Started saving go dependencies
5:32:44 AM: Finished saving go dependencies
5:32:44 AM: Build failed due to a user error: Build script returned non-zero exit code: 2
5:32:44 AM: Failing build: Failed to build site
5:32:44 AM: Finished processing build request in 28.128776261s
uroybd commented 1 year ago

@oleeskild since we are uploading images now, this issue shouldn't occur.