Open ajotaos opened 1 month ago
Also experiencing this
This seems to be an issue w/ npm 8.
@ajotaos @dividenconquer Can you update npm
to v10 and let me know if sst dev
and sst deploy
still fail?
^ note for @fwang if verified to be a npm v8 issue, should check users' npm version
Hi @fwang, I'm actually using pnpm v9.7.0 and also have npm installed globally v10.8.1
@ajotaos if u try these steps, do u get an error on step 4?
mkdir sharp-test && cd sharp-test
npm init -y
npm install sharp
node -e "console.log(require('sharp'))"
@fwang I'm not getting an error, it prints out the sharp object as normal.
[Function: Sharp] {
align: { left: 'low', center: 'centre', centre: 'centre', right: 'high' },
gravity: {
center: 0,
centre: 0,
north: 1,
east: 2,
south: 3,
west: 4,
northeast: 5,
southeast: 6,
southwest: 7,
northwest: 8
},
strategy: { entropy: 16, attention: 17 },
kernel: {
nearest: 'nearest',
linear: 'linear',
cubic: 'cubic',
mitchell: 'mitchell',
lanczos2: 'lanczos2',
lanczos3: 'lanczos3'
},
fit: {
contain: 'contain',
cover: 'cover',
fill: 'fill',
inside: 'inside',
outside: 'outside'
},
position: {
top: 1,
right: 2,
bottom: 3,
left: 4,
'right top': 5,
'right bottom': 6,
'left bottom': 7,
'left top': 8
},
blend: {
clear: 'clear',
source: 'source',
over: 'over',
in: 'in',
out: 'out',
atop: 'atop',
dest: 'dest',
'dest-over': 'dest-over',
'dest-in': 'dest-in',
'dest-out': 'dest-out',
'dest-atop': 'dest-atop',
xor: 'xor',
add: 'add',
saturate: 'saturate',
multiply: 'multiply',
screen: 'screen',
overlay: 'overlay',
darken: 'darken',
lighten: 'lighten',
'colour-dodge': 'colour-dodge',
'color-dodge': 'colour-dodge',
'colour-burn': 'colour-burn',
'color-burn': 'colour-burn',
'hard-light': 'hard-light',
'soft-light': 'soft-light',
difference: 'difference',
exclusion: 'exclusion'
},
colourspace: {
multiband: 'multiband',
'b-w': 'b-w',
bw: 'b-w',
cmyk: 'cmyk',
srgb: 'srgb'
},
colorspace: {
multiband: 'multiband',
'b-w': 'b-w',
bw: 'b-w',
cmyk: 'cmyk',
srgb: 'srgb'
},
bool: { and: 'and', or: 'or', eor: 'eor' },
cache: [Function: cache],
concurrency: [Function: concurrency],
counters: [Function: counters],
simd: [Function: simd],
format: {
jpeg: { id: 'jpeg', input: [Object], output: [Object] },
png: { id: 'png', input: [Object], output: [Object] },
webp: { id: 'webp', input: [Object], output: [Object] },
tiff: { id: 'tiff', input: [Object], output: [Object] },
magick: { id: 'magick', input: [Object], output: [Object] },
openslide: { id: 'openslide', input: [Object], output: [Object] },
dz: { id: 'dz', input: [Object], output: [Object] },
ppm: { id: 'ppm', input: [Object], output: [Object] },
fits: { id: 'fits', input: [Object], output: [Object] },
gif: { id: 'gif', input: [Object], output: [Object] },
svg: { id: 'svg', input: [Object], output: [Object] },
heif: { id: 'heif', input: [Object], output: [Object] },
pdf: { id: 'pdf', input: [Object], output: [Object] },
vips: { id: 'vips', input: [Object], output: [Object] },
jp2k: { id: 'jp2k', input: [Object], output: [Object] },
jxl: { id: 'jxl', input: [Object], output: [Object] },
raw: { id: 'raw', input: [Object], output: [Object] }
},
interpolators: {
nearest: 'nearest',
bilinear: 'bilinear',
bicubic: 'bicubic',
locallyBoundedBicubic: 'lbb',
nohalo: 'nohalo',
vertexSplitQuadraticBasisSpline: 'vsqbs'
},
versions: {
aom: '3.8.2',
archive: '3.7.2',
cairo: '1.18.0',
cgif: '0.3.2',
exif: '0.6.24',
expat: '2.6.2',
ffi: '3.4.6',
fontconfig: '2.15.0',
freetype: '2.13.2',
fribidi: '1.0.13',
gdkpixbuf: '2.42.10',
glib: '2.80.0',
harfbuzz: '8.3.0',
heif: '1.17.6',
highway: '1.1.0',
imagequant: '2.4.1',
lcms: '2.16',
mozjpeg: '4.1.5',
pango: '1.52.1',
pixman: '0.43.4',
png: '1.6.43',
'proxy-libintl': '0.4',
rsvg: '2.57.2',
spng: '0.7.4',
tiff: '4.6.0',
vips: '8.15.2',
webp: '1.3.2',
xml: '2.12.6',
'zlib-ng': '2.1.6',
sharp: '0.33.4'
},
queue: EventEmitter {
_events: [Object: null prototype] {},
_eventsCount: 0,
_maxListeners: undefined,
[Symbol(shapeMode)]: false,
[Symbol(kCapture)]: false
},
block: [Function: block],
unblock: [Function: unblock]
}
@fwang is it possible to know where the lambda code is looking the sharp library in while running in dev?
I put an example together for sharp: https://sst.dev/docs/examples/#sharp-image-resizer
And here's the repo for it: https://github.com/sst/ion/tree/dev/examples/aws-sharp
I have a pnpm monorepo, with one of the packages making use of the
sharp
library and a different package importing the first one where the lambda function code is located:So when I try to run the function without installing sharp, everything is fine and the function runs. But as soon as the function is triggered while importing the
sharp
library, I get the following message on the console (can't copy / past from the new Ion SST console)On
sst dev
And on
sst deploy
I'm not sure if this is the correct way to solve this (please advise if not), but I created a lambda layer of sharp with the options like and it seems to work on deploy:
But I can't get it to work on
sst dev
I've also tried using:
Placing this on the root
package.json
Install sharp on
--no-install=false
Using SST (not Ion) I was able to use sharp without any additional configuration to the function component, how would it be suggested now?