strapi-plugin-placeholder icon indicating copy to clipboard operation
strapi-plugin-placeholder copied to clipboard

importing files fails

Open nikravi opened this issue 1 year ago • 4 comments

when importing images on a new strapi instance, strapi-placeholder plugin fails staring at the lifecycle

> npm run strapi transfer --from https:///admin # command
ENOENT: no such file or directory, open '/opt/app/public/uploads/jase_harris_AO_Z_N_Bt_GSE_unsplash_f4fb7d6b69.jpg'
Error: ENOENT: no such file or directory, open '/opt/app/public/uploads/jase_harris_AO_Z_N_Bt_GSE_unsplash_f4fb7d6b69.jpg'
    at Object.openSync (node:fs:590:3)
    at syncFileToBuffer (/opt/node_modules/plaiceholder/dist/index.js:84081:47)
    at imageSize (/opt/node_modules/plaiceholder/dist/index.js:84120:24)
    at getImageSize (/opt/node_modules/plaiceholder/dist/index.js:84152:7)
    at loadImage (/opt/node_modules/plaiceholder/dist/index.js:84205:21)
    at getImage (/opt/node_modules/plaiceholder/dist/index.js:84272:13)
    at getPlaiceholder (/opt/node_modules/plaiceholder/dist/index.js:84350:13)
    at Object.generate (/opt/node_modules/strapi-plugin-placeholder/server/services/placeholder.js:16:32)
    at Object.generatePlaceholder (/opt/node_modules/strapi-plugin-placeholder/server/bootstrap.js:20:64)
    at Object.run (/opt/node_modules/@strapi/database/lib/lifecycles/index.js:76:35)

any ideas what is causing this?

nikravi avatar Aug 05 '23 02:08 nikravi

Check this PR: https://github.com/WalkingPizza/strapi-plugin-placeholder/pull/16

You can try my temporary fork. In npm: @finsimco/strapi-plugin-placeholder

This happens because placeholder generation happens way before assets transfer/import.

Transfer should preserve existing placeholders in database/records, not generate new ones, so my PR will help.

maybephilipp avatar Aug 30 '23 12:08 maybephilipp

Check this PR: #16

You can try my temporary fork. In npm: @finsimco/strapi-plugin-placeholder

This happens because placeholder generation happens way before assets transfer/import.

Transfer should preserve existing placeholders in database/records, not generate new ones, so my PR will help.

I got your fork and it's failing with error:

[ERROR] Error while uploading asset art_fluid_upscayl_4x_realesrgan_x4plus_b982f78f88.jpg Error: Undefined binding(s) detected when compiling WHERE. Undefined column(s): [t0.id] query: where "t0"."id" = ?

nikravi avatar Oct 01 '23 10:10 nikravi

Hey guys, super busy with work, but I will try to take a look at this issue in this weekend.

yasssuz avatar Oct 03 '23 21:10 yasssuz

I got your fork and it's failing with error

Hey @nikravi ! I checked my changes again to try to find something that could cause this error. I haven't changed any interaction with database nor something related. I have only added conditional patching of placeholder value itself and logging rules.

So, I think, less likely that this error is caused by my changes. Must be related to some version changes or completely unrelated issue.

More details needed for future investigation:)

maybephilipp avatar Oct 04 '23 11:10 maybephilipp