pigallery2 icon indicating copy to clipboard operation
pigallery2 copied to clipboard

Regenerate thumbnails: Job error: TypeError: config.sizes is not iterable

Open zigmhount opened this issue 2 years ago • 2 comments

I'm having some issues with the aspect ratio of thumbnails, probably similar to #212. I replaced some pictures and tried to regenerate the thumbnails by clicking on the corresponding button in the advanced config, but I'm consistently getting Job error: TypeError: config.sizes is not iterable: image

Running pigallery2 with the docker image nightly-debian-buster, with a different user than root which has read access to the pictures hosted on Nextcloud (user www-data, ID 33) - the issue is the same when running the container with the default root user :

version: '3'
services:
  pigallery2:
    image: bpatrik/pigallery2:nightly-debian-buster
    container_name: pigallery2
    environment:
      - NODE_ENV=debug
      - PORT=8080
    user: "33:33"    # www-data
    volumes:
      - "/mnt/raid1/pigallery2/config:/app/data/config" # Changed
      - "/mnt/raid1/pigallery2/db-data:/app/data/db"
      - "/mnt/raid1/clouddata/path/to/photos1:/app/data/images/photos1:ro"
      - "/mnt/raid1/pigallery2/tmp:/app/data/tmp" # Changed
    ports:
      - 3000:8080
    restart: always

Server logs (docker)

3/16/2022, 7:26:36 PM[VERBS] GET /api/admin/statistic 304 59ms
3/16/2022, 7:26:36 PM[VERBS] GET /api/user/list 304 10ms
3/16/2022, 7:26:36 PM[VERBS] GET /api/share/list 304 18ms
3/16/2022, 7:26:36 PM[VERBS] GET /api/admin/jobs/scheduled/progress 304 14ms
3/16/2022, 7:26:36 PM[VERBS] GET /api/admin/jobs/available 304 8ms
[Typeconfig] Loading defaults from file: undefined
[Typeconfig] Loading defaults, def prefix: default
[Typeconfig] no default cli found among these: {
	"expose": {
		"gc": true
	},
	"config": {
		"path": "/app/data/config/config.json"
	}
}
[Typeconfig] from env: {
	"Server": {
		"Database": {
			"dbFolder": "/app/data/db"
		},
		"Media": {
			"folder": "/app/data/images",
			"tempFolder": "/app/data/tmp"
		}
	}
}
[Typeconfig] Loading defaults from file: undefined
[Typeconfig] Loading defaults, def prefix: default
[Typeconfig] no default cli found among these: {
	"expose": {
		"gc": true
	},
	"config": {
		"path": "/app/data/config/config.json"
	}
}
[Typeconfig] from env: {
	"Server": {
		"Database": {
			"dbFolder": "/app/data/db"
		},
		"Media": {
			"folder": "/app/data/images",
			"tempFolder": "/app/data/tmp"
		}
	}
}
[Typeconfig] Processing cli and ENV inputs: {
	"expose": {
		"gc": true
	},
	"config": {
		"path": "/app/data/config/config.json"
	}
}
[Typeconfig] Processing cli and ENV inputs: {
	"PATH": "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
	"HOSTNAME": "57587c51042b",
	"NODE_ENV": "debug",
	"PORT": "8080",
	"NODE_VERSION": "14.19.0",
	"YARN_VERSION": "1.22.17",
	"PI_DOCKER": true,
	"HOME": "/var/www",
	"VIPS_MIN_STACK_SIZE": "2m",
	"VIPSHOME": "/target",
	"Server": {
		"port": "8080"
	}
}
3/16/2022, 7:26:37 PM[VERBS] GET /api/settings 304 328ms
[Typeconfig] Processing cli and ENV inputs: {
	"expose": {
		"gc": true
	},
	"config": {
		"path": "/app/data/config/config.json"
	}
}
[Typeconfig] Processing cli and ENV inputs: {
	"PATH": "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
	"HOSTNAME": "57587c51042b",
	"NODE_ENV": "debug",
	"PORT": "8080",
	"NODE_VERSION": "14.19.0",
	"YARN_VERSION": "1.22.17",
	"PI_DOCKER": true,
	"HOME": "/var/www",
	"VIPS_MIN_STACK_SIZE": "2m",
	"VIPSHOME": "/target",
	"Server": {
		"port": "8080"
	}
}
3/16/2022, 7:26:37 PM[VERBS] GET /api/settings 200 321ms
3/16/2022, 7:26:41 PM[VERBS] GET /api/admin/jobs/scheduled/progress 304 11ms
3/16/2022, 7:26:42 PM[WARN_] Handled error:
ErrorDTO {
  code: 15,
  message: 'Job error: TypeError: config.sizes is not iterable',
  details: TypeError: config.sizes is not iterable
      at ThumbnailGenerationJob.start (/app/src/backend/model/jobs/jobs/ThumbnailGenerationJob.js:36:35)
      at JobManager.<anonymous> (/app/src/backend/model/jobs/JobManager.js:68:25)
      at Generator.next (<anonymous>)
      at /app/src/backend/model/jobs/JobManager.js:8:71
      at new Promise (<anonymous>)
      at __awaiter (/app/src/backend/model/jobs/JobManager.js:4:12)
      at JobManager.run (/app/src/backend/model/jobs/JobManager.js:61:16)
      at /app/src/backend/middlewares/admin/AdminMWs.js:68:80
      at Generator.next (<anonymous>)
      at /app/src/backend/middlewares/admin/AdminMWs.js:8:71
      at new Promise (<anonymous>)
      at __awaiter (/app/src/backend/middlewares/admin/AdminMWs.js:4:12)
      at startJob (/app/src/backend/middlewares/admin/AdminMWs.js:62:16)
      at Layer.handle [as handle_request] (/app/node_modules/express/lib/router/layer.js:95:5)
      at next (/app/node_modules/express/lib/router/route.js:137:13)
      at authorise (/app/src/backend/middlewares/user/AuthenticationMWs.js:96:20)
      at Layer.handle [as handle_request] (/app/node_modules/express/lib/router/layer.js:95:5)
      at next (/app/node_modules/express/lib/router/route.js:137:13)
      at /app/src/backend/middlewares/user/AuthenticationMWs.js:54:24
      at Generator.next (<anonymous>)
      at /app/src/backend/middlewares/user/AuthenticationMWs.js:8:71
      at new Promise (<anonymous>),
  request: { method: '', url: '' },
  detailsStr: 'TypeError: config.sizes is not iterable'
}

Environment (please complete the following information):

  • OS: Docker on Debian, Browser on Linux or Android
  • Browser: Firefox and Chrome on Linux, Fennec and Chrome on Android

Used app version:

  • docker-nightly: Application version: v1.9.3 Built at: Mar 12, 2022, 9:50:29 PM Git commit: c6aaa0e0603e60d5a71c67cc8b3bef4d45a6ee8c

zigmhount avatar Mar 16 '22 19:03 zigmhount

I got exactly the same error with the default docker-compose file and the latest nightly image on another computer:

pigallery2    | 3/16/2022, 7:52:00 PM[VERBS] GET /api/settings 200 75ms
pigallery2    | 3/16/2022, 7:52:00 PM[VERBS] GET /api/admin/statistic 304 13ms
pigallery2    | 3/16/2022, 7:52:00 PM[DEBUG] GET /assets/icon_inv.png 200 6ms
pigallery2    | 3/16/2022, 7:52:00 PM[VERBS] GET /api/user/me 200 3ms
pigallery2    | 3/16/2022, 7:52:00 PM[VERBS] GET /api/user/list 304 8ms
pigallery2    | [Typeconfig] Loading defaults from file: undefined
pigallery2    | [Typeconfig] Loading defaults, def prefix: default
pigallery2    | [Typeconfig] no default cli found among these: {
pigallery2    | 	"expose": {
pigallery2    | 		"gc": true
pigallery2    | 	},
pigallery2    | 	"config": {
pigallery2    | 		"path": "/app/data/config/config.json"
pigallery2    | 	}
pigallery2    | }
pigallery2    | [Typeconfig] from env: {
pigallery2    | 	"Server": {
pigallery2    | 		"Database": {
pigallery2    | 			"dbFolder": "/app/data/db"
pigallery2    | 		},
pigallery2    | 		"Media": {
pigallery2    | 			"folder": "/app/data/images",
pigallery2    | 			"tempFolder": "/app/data/tmp"
pigallery2    | 		}
pigallery2    | 	}
pigallery2    | }
pigallery2    | [Typeconfig] Processing cli and ENV inputs: {
pigallery2    | 	"expose": {
pigallery2    | 		"gc": true
pigallery2    | 	},
pigallery2    | 	"config": {
pigallery2    | 		"path": "/app/data/config/config.json"
pigallery2    | 	}
pigallery2    | }
pigallery2    | [Typeconfig] Processing cli and ENV inputs: {
pigallery2    | 	"PATH": "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
pigallery2    | 	"HOSTNAME": "b943477da328",
pigallery2    | 	"NODE_ENV": "debug",
pigallery2    | 	"NODE_VERSION": "14.19.0",
pigallery2    | 	"YARN_VERSION": "1.22.17",
pigallery2    | 	"PI_DOCKER": true,
pigallery2    | 	"HOME": "/root",
pigallery2    | 	"VIPS_MIN_STACK_SIZE": "2m",
pigallery2    | 	"VIPSHOME": "/target"
pigallery2    | }
pigallery2    | 3/16/2022, 7:52:01 PM[VERBS] GET /api/settings 304 43ms
pigallery2    | 3/16/2022, 7:52:01 PM[VERBS] GET /api/admin/jobs/scheduled/progress 304 2ms
pigallery2    | 3/16/2022, 7:52:01 PM[VERBS] GET /api/share/list 304 13ms
pigallery2    | 3/16/2022, 7:52:01 PM[VERBS] GET /api/admin/jobs/available 304 3ms
pigallery2    | 3/16/2022, 7:52:03 PM[WARN_] Handled error:
pigallery2    | ErrorDTO {
pigallery2    |   code: 15,
pigallery2    |   message: 'Job error: TypeError: config.sizes is not iterable',
pigallery2    |   details: TypeError: config.sizes is not iterable
pigallery2    |       at ThumbnailGenerationJob.start (/app/src/backend/model/jobs/jobs/ThumbnailGenerationJob.js:36:35)
pigallery2    |       at JobManager.<anonymous> (/app/src/backend/model/jobs/JobManager.js:68:25)
pigallery2    |       at Generator.next (<anonymous>)
pigallery2    |       at /app/src/backend/model/jobs/JobManager.js:8:71
pigallery2    |       at new Promise (<anonymous>)
pigallery2    |       at __awaiter (/app/src/backend/model/jobs/JobManager.js:4:12)
pigallery2    |       at JobManager.run (/app/src/backend/model/jobs/JobManager.js:61:16)
pigallery2    |       at /app/src/backend/middlewares/admin/AdminMWs.js:68:80
pigallery2    |       at Generator.next (<anonymous>)
pigallery2    |       at /app/src/backend/middlewares/admin/AdminMWs.js:8:71
pigallery2    |       at new Promise (<anonymous>)
pigallery2    |       at __awaiter (/app/src/backend/middlewares/admin/AdminMWs.js:4:12)
pigallery2    |       at startJob (/app/src/backend/middlewares/admin/AdminMWs.js:62:16)
pigallery2    |       at Layer.handle [as handle_request] (/app/node_modules/express/lib/router/layer.js:95:5)
pigallery2    |       at next (/app/node_modules/express/lib/router/route.js:137:13)
pigallery2    |       at authorise (/app/src/backend/middlewares/user/AuthenticationMWs.js:96:20)
pigallery2    |       at Layer.handle [as handle_request] (/app/node_modules/express/lib/router/layer.js:95:5)
pigallery2    |       at next (/app/node_modules/express/lib/router/route.js:137:13)
pigallery2    |       at /app/src/backend/middlewares/user/AuthenticationMWs.js:54:24
pigallery2    |       at Generator.next (<anonymous>)
pigallery2    |       at /app/src/backend/middlewares/user/AuthenticationMWs.js:8:71
pigallery2    |       at new Promise (<anonymous>),
pigallery2    |   request: { method: '', url: '' },
pigallery2    |   detailsStr: 'TypeError: config.sizes is not iterable'
pigallery2    | }

zigmhount avatar Mar 16 '22 19:03 zigmhount

Hi, I am facing the same issue and went looking for a solution. This change seems to do the trick, thumbnails are being generated again just fine:

Original code (thumbnail.settings.component.ts#L53):


return {sizes: this.states.client.thumbnailSizes.original[0]};

Fix:

return {sizes: this.states.client.thumbnailSizes.original};

The full array of original thumbnailSizes seems to be then picked up here: ThumbnailGenerationJob.ts#L36

Disclaimer: I am new to this project, Angular and JavaScript/TypeScript. I cannot say if this change has any undesired side-effects. @bpatrik If this change does make sense, and you are busy, I can also provide a pull request if you want.

tilmanginzel avatar Apr 26 '22 12:04 tilmanginzel

To my understanding this is fixed. Closing it. Feel free to reopen if you think otherwise.

bpatrik avatar Dec 09 '22 21:12 bpatrik