Skip to content
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

Allow image-pool to be used as its own Worker #5317

Merged
merged 6 commits into from
Nov 8, 2022
Merged

Allow image-pool to be used as its own Worker #5317

merged 6 commits into from
Nov 8, 2022

Conversation

matthewp
Copy link
Contributor

@matthewp matthewp commented Nov 7, 2022

Changes

Testing

Docs

N/A, bug fix

@changeset-bot
Copy link

changeset-bot bot commented Nov 7, 2022

🦋 Changeset detected

Latest commit: 328881f

The changes in this PR will be included in the next version bump.

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions github-actions bot added the pkg: integration Related to any renderer integration (scope) label Nov 7, 2022
@matthewp matthewp marked this pull request as draft November 7, 2022 21:56
@matthewp matthewp marked this pull request as ready for review November 7, 2022 22:13
Copy link
Contributor

@tony-sull tony-sull left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there specific about the hosted SSR environments that allowed @astrojs/image to work in our SSR tests and locally with the node adapter but break in Netlify/Vercel? Or are the existing SSR tests broken?

@matthewp
Copy link
Contributor Author

matthewp commented Nov 8, 2022

!preview vercel-image

@github-actions
Copy link
Contributor

github-actions bot commented Nov 8, 2022

 > root@0.0.0 release /home/runner/work/astro/astro > pnpm run build && changeset publish "--tag" "next--vercel-image" > root@0.0.0 build /home/runner/work/astro/astro > turbo run build --output-logs=new-only --no-deps --filter=astro --filter=create-astro --filter="@astrojs/*" �[2m• Packages in scope: @astrojs/alpinejs, @astrojs/cloudflare, @astrojs/deno, @astrojs/image, @astrojs/lit, @astrojs/markdown-component, @astrojs/markdown-remark, @astrojs/mdx, @astrojs/netlify, @astrojs/node, @astrojs/partytown, @astrojs/preact, @astrojs/prefetch, @astrojs/prism, @astrojs/react, @astrojs/rss, @astrojs/sitemap, @astrojs/solid-js, @astrojs/svelte, @astrojs/tailwind, @astrojs/telemetry, @astrojs/turbolinks, @astrojs/vercel, @astrojs/vue, @astrojs/webapi, astro, create-astro�[0m �[2m• Running�[0m �[2m�[1mbuild�[0m�[0m �[2min 27 packages�[0m �[2m• Remote computation caching enabled (experimental)�[0m �[35m@astrojs/webapi:build: �[0mcache hit, suppressing output �[2m2119a6e9c67d8536�[0m �[34mcreate-astro:build: �[0mcache hit, suppressing output �[2me4608ffa89a4b79a�[0m �[36m@astrojs/prism:build: �[0mcache hit, suppressing output �[2m2bade6b6b28e42a6�[0m �[33m@astrojs/telemetry:build: �[0mcache hit, suppressing output �[2m1cc374bafafff507�[0m �[35m@astrojs/markdown-remark:build: �[0mcache hit, suppressing output �[2m1e4cf77312e3d89d�[0m �[32mastro:build: �[0mcache hit, suppressing output �[2me591f9d0586f9eab�[0m �[34m@astrojs/cloudflare:build: �[0mcache hit, suppressing output �[2m90a638f6bf8ef71a�[0m �[35m@astrojs/mdx:build: �[0mcache hit, suppressing output �[2md96167e80e483dcc�[0m �[32m@astrojs/turbolinks:build: �[0mcache hit, suppressing output �[2mf6708610a93855cf�[0m �[33m@astrojs/sitemap:build: �[0mcache hit, suppressing output �[2mb34f2ffd784a20d3�[0m �[33m@astrojs/prefetch:build: �[0mcache hit, suppressing output �[2m8a87047e762d784e�[0m �[33m@astrojs/tailwind:build: �[0mcache hit, suppressing output �[2mce1448131d9f45f5�[0m �[32m@astrojs/rss:build: �[0mcache hit, suppressing output �[2mcd30f03609e6adf0�[0m �[34m@astrojs/deno:build: �[0mcache hit, suppressing output �[2m4c48c31d28b859d1�[0m �[35m@astrojs/partytown:build: �[0mcache hit, suppressing output �[2m3ca0179bdc663a87�[0m �[35m@astrojs/react:build: �[0mcache hit, suppressing output �[2m2fc2ab1417848f66�[0m �[34m@astrojs/preact:build: �[0mcache hit, suppressing output �[2md5a8e6869468f015�[0m �[36m@astrojs/alpinejs:build: �[0mcache hit, suppressing output �[2ma20cbcb69f6aa3c1�[0m �[33m@astrojs/lit:build: �[0mcache hit, suppressing output �[2me24e42761dbcd30c�[0m �[34m@astrojs/node:build: �[0mcache hit, suppressing output �[2m20cbab8e0d982a48�[0m �[36m@astrojs/svelte:build: �[0mcache hit, suppressing output �[2me93f960ba3128569�[0m �[36m@astrojs/vue:build: �[0mcache hit, suppressing output �[2m32486eb1b378c5c7�[0m �[36m@astrojs/solid-js:build: �[0mcache hit, suppressing output �[2m3362a50b271c932f�[0m �[35m@astrojs/vercel:build: �[0mcache hit, suppressing output �[2m5e6cb80f9a930bbd�[0m �[32m@astrojs/netlify:build: �[0mcache hit, suppressing output �[2m81258e6689e50ec5�[0m �[33m@astrojs/image:build: �[0mcache miss, executing �[2ma67ae54a52578e32�[0m �[33m@astrojs/image:build: �[0m �[33m@astrojs/image:build: �[0m> @astrojs/image@0.0.0-vercel-image-20221108131724 build /home/runner/work/astro/astro/packages/integrations/image �[33m@astrojs/image:build: �[0m> astro-scripts build "src/**/*.ts" && tsc && pnpm run postbuild �[33m@astrojs/image:build: �[0m �[33m@astrojs/image:build: �[0m �[33m@astrojs/image:build: �[0m> @astrojs/image@0.0.0-vercel-image-20221108131724 postbuild /home/runner/work/astro/astro/packages/integrations/image �[33m@astrojs/image:build: �[0m> astro-scripts copy "src/**/*.wasm" �[33m@astrojs/image:build: �[0m Tasks: 26 successful, 26 total Cached: 25 cached, 26 total Time: 6.906s 🦋 �[33mwarn�[39m �[31m===============================IMPORTANT!===============================�[39m 🦋 �[33mwarn�[39m Packages will be released under the next--vercel-image tag 🦋 �[33mwarn�[39m �[31m----------------------------------------------------------------------�[39m 🦋 �[36minfo�[39m npm info astro 🦋 �[36minfo�[39m npm info @astrojs/prism 🦋 �[36minfo�[39m npm info @astrojs/rss 🦋 �[36minfo�[39m npm info create-astro 🦋 �[36minfo�[39m npm info @astrojs/alpinejs 🦋 �[36minfo�[39m npm info @astrojs/cloudflare 🦋 �[36minfo�[39m npm info @astrojs/deno 🦋 �[36minfo�[39m npm info @astrojs/image 🦋 �[36minfo�[39m npm info @astrojs/lit 🦋 �[36minfo�[39m npm info @astrojs/mdx 🦋 �[36minfo�[39m npm info @astrojs/netlify 🦋 �[36minfo�[39m npm info @astrojs/node 🦋 �[36minfo�[39m npm info @astrojs/partytown 🦋 �[36minfo�[39m npm info @astrojs/preact 🦋 �[36minfo�[39m npm info @astrojs/prefetch 🦋 �[36minfo�[39m npm info @astrojs/react 🦋 �[36minfo�[39m npm info @astrojs/sitemap 🦋 �[36minfo�[39m npm info @astrojs/solid-js 🦋 �[36minfo�[39m npm info @astrojs/svelte 🦋 �[36minfo�[39m npm info @astrojs/tailwind 🦋 �[36minfo�[39m npm info @astrojs/turbolinks 🦋 �[36minfo�[39m npm info @astrojs/vercel 🦋 �[36minfo�[39m npm info @astrojs/vue 🦋 �[36minfo�[39m npm info @astrojs/markdown-component 🦋 �[36minfo�[39m npm info @astrojs/markdown-remark 🦋 �[36minfo�[39m npm info @astrojs/telemetry 🦋 �[36minfo�[39m npm info @astrojs/webapi 🦋 �[33mwarn�[39m astro is not being published because version 1.6.4 is already published on npm 🦋 �[33mwarn�[39m @astrojs/prism is not being published because version 1.0.2 is already published on npm 🦋 �[33mwarn�[39m @astrojs/rss is not being published because version 1.0.3 is already published on npm 🦋 �[33mwarn�[39m create-astro is not being published because version 1.2.1 is already published on npm 🦋 �[33mwarn�[39m @astrojs/alpinejs is not being published because version 0.1.2 is already published on npm 🦋 �[33mwarn�[39m @astrojs/cloudflare is not being published because version 4.0.0 is already published on npm 🦋 �[33mwarn�[39m @astrojs/deno is not being published because version 2.0.0 is already published on npm 🦋 �[36minfo�[39m @astrojs/image is being published because our local version (0.0.0-vercel-image-20221108131724) has not been published on npm 🦋 �[33mwarn�[39m @astrojs/lit is not being published because version 1.0.1 is already published on npm 🦋 �[33mwarn�[39m @astrojs/mdx is not being published because version 0.11.5 is already published on npm 🦋 �[33mwarn�[39m @astrojs/netlify is not being published because version 1.2.0 is already published on npm 🦋 �[33mwarn�[39m @astrojs/node is not being published because version 3.0.0 is already published on npm 🦋 �[33mwarn�[39m @astrojs/partytown is not being published because version 1.0.1 is already published on npm 🦋 �[33mwarn�[39m @astrojs/preact is not being published because version 1.2.0 is already published on npm 🦋 �[33mwarn�[39m @astrojs/prefetch is not being published because version 0.1.1 is already published on npm 🦋 �[33mwarn�[39m @astrojs/react is not being published because version 1.2.2 is already published on npm 🦋 �[33mwarn�[39m @astrojs/sitemap is not being published because version 1.0.0 is already published on npm 🦋 �[33mwarn�[39m @astrojs/solid-js is not being published because version 1.2.2 is already published on npm 🦋 �[33mwarn�[39m @astrojs/svelte is not being published because version 1.0.2 is already published on npm 🦋 �[33mwarn�[39m @astrojs/tailwind is not being published because version 2.1.2 is already published on npm 🦋 �[33mwarn�[39m @astrojs/turbolinks is not being published because version 0.1.4 is already published on npm 🦋 �[33mwarn�[39m @astrojs/vercel is not being published because version 2.3.3 is already published on npm 🦋 �[33mwarn�[39m @astrojs/vue is not being published because version 1.2.1 is already published on npm 🦋 �[33mwarn�[39m @astrojs/markdown-component is not being published because version 1.0.2 is already published on npm 🦋 �[33mwarn�[39m @astrojs/markdown-remark is not being published because version 1.1.3 is already published on npm 🦋 �[33mwarn�[39m @astrojs/telemetry is not being published because version 1.0.1 is already published on npm 🦋 �[33mwarn�[39m @astrojs/webapi is not being published because version 1.1.1 is already published on npm 🦋 �[36minfo�[39m Publishing �[36m"@astrojs/image"�[39m at �[32m"0.0.0-vercel-image-20221108131724"�[39m 🦋 �[32msuccess�[39m packages published successfully: 🦋 @astrojs/image@0.0.0-vercel-image-20221108131724 🦋 Creating git tag... 🦋 New tag: @astrojs/image@0.0.0-vercel-image-20221108131724

@matthewp
Copy link
Contributor Author

matthewp commented Nov 8, 2022

!preview vercel-image

@github-actions
Copy link
Contributor

github-actions bot commented Nov 8, 2022

 > root@0.0.0 release /home/runner/work/astro/astro > pnpm run build && changeset publish "--tag" "next--vercel-image" > root@0.0.0 build /home/runner/work/astro/astro > turbo run build --output-logs=new-only --no-deps --filter=astro --filter=create-astro --filter="@astrojs/*" �[2m• Packages in scope: @astrojs/alpinejs, @astrojs/cloudflare, @astrojs/deno, @astrojs/image, @astrojs/lit, @astrojs/markdown-component, @astrojs/markdown-remark, @astrojs/mdx, @astrojs/netlify, @astrojs/node, @astrojs/partytown, @astrojs/preact, @astrojs/prefetch, @astrojs/prism, @astrojs/react, @astrojs/rss, @astrojs/sitemap, @astrojs/solid-js, @astrojs/svelte, @astrojs/tailwind, @astrojs/telemetry, @astrojs/turbolinks, @astrojs/vercel, @astrojs/vue, @astrojs/webapi, astro, create-astro�[0m �[2m• Running�[0m �[2m�[1mbuild�[0m�[0m �[2min 27 packages�[0m �[2m• Remote computation caching enabled (experimental)�[0m �[35m@astrojs/webapi:build: �[0mcache hit, suppressing output �[2m2119a6e9c67d8536�[0m �[34mcreate-astro:build: �[0mcache hit, suppressing output �[2me4608ffa89a4b79a�[0m �[36m@astrojs/prism:build: �[0mcache hit, suppressing output �[2m2bade6b6b28e42a6�[0m �[33m@astrojs/telemetry:build: �[0mcache hit, suppressing output �[2m1cc374bafafff507�[0m �[35m@astrojs/markdown-remark:build: �[0mcache hit, suppressing output �[2m1e4cf77312e3d89d�[0m �[32mastro:build: �[0mcache hit, suppressing output �[2me591f9d0586f9eab�[0m �[34m@astrojs/alpinejs:build: �[0mcache hit, suppressing output �[2ma20cbcb69f6aa3c1�[0m �[36m@astrojs/svelte:build: �[0mcache hit, suppressing output �[2me93f960ba3128569�[0m �[35m@astrojs/node:build: �[0mcache hit, suppressing output �[2m20cbab8e0d982a48�[0m �[32m@astrojs/sitemap:build: �[0mcache hit, suppressing output �[2mb34f2ffd784a20d3�[0m �[33m@astrojs/turbolinks:build: �[0mcache hit, suppressing output �[2mf6708610a93855cf�[0m �[34m@astrojs/rss:build: �[0mcache hit, suppressing output �[2mcd30f03609e6adf0�[0m �[35m@astrojs/partytown:build: �[0mcache hit, suppressing output �[2m3ca0179bdc663a87�[0m �[36m@astrojs/preact:build: �[0mcache hit, suppressing output �[2md5a8e6869468f015�[0m �[33m@astrojs/cloudflare:build: �[0mcache hit, suppressing output �[2m90a638f6bf8ef71a�[0m �[32m@astrojs/netlify:build: �[0mcache hit, suppressing output �[2m81258e6689e50ec5�[0m �[34m@astrojs/prefetch:build: �[0mcache hit, suppressing output �[2m8a87047e762d784e�[0m �[36m@astrojs/tailwind:build: �[0mcache hit, suppressing output �[2mce1448131d9f45f5�[0m �[35m@astrojs/vue:build: �[0mcache hit, suppressing output �[2m32486eb1b378c5c7�[0m �[32m@astrojs/deno:build: �[0mcache hit, suppressing output �[2m4c48c31d28b859d1�[0m �[33m@astrojs/lit:build: �[0mcache hit, suppressing output �[2me24e42761dbcd30c�[0m �[33m@astrojs/vercel:build: �[0mcache hit, suppressing output �[2m5e6cb80f9a930bbd�[0m �[34m@astrojs/react:build: �[0mcache hit, suppressing output �[2m2fc2ab1417848f66�[0m �[32m@astrojs/solid-js:build: �[0mcache hit, suppressing output �[2m3362a50b271c932f�[0m �[36m@astrojs/mdx:build: �[0mcache hit, suppressing output �[2md96167e80e483dcc�[0m �[35m@astrojs/image:build: �[0mcache miss, executing �[2m71daa65fd0d5fdc7�[0m �[35m@astrojs/image:build: �[0m �[35m@astrojs/image:build: �[0m> @astrojs/image@0.0.0-vercel-image-20221108134223 build /home/runner/work/astro/astro/packages/integrations/image �[35m@astrojs/image:build: �[0m> astro-scripts build "src/**/*.ts" && tsc && pnpm run postbuild �[35m@astrojs/image:build: �[0m �[35m@astrojs/image:build: �[0m �[35m@astrojs/image:build: �[0m> @astrojs/image@0.0.0-vercel-image-20221108134223 postbuild /home/runner/work/astro/astro/packages/integrations/image �[35m@astrojs/image:build: �[0m> astro-scripts copy "src/**/*.wasm" �[35m@astrojs/image:build: �[0m Tasks: 26 successful, 26 total Cached: 25 cached, 26 total Time: 7.343s 🦋 �[33mwarn�[39m �[31m===============================IMPORTANT!===============================�[39m 🦋 �[33mwarn�[39m Packages will be released under the next--vercel-image tag 🦋 �[33mwarn�[39m �[31m----------------------------------------------------------------------�[39m 🦋 �[36minfo�[39m npm info astro 🦋 �[36minfo�[39m npm info @astrojs/prism 🦋 �[36minfo�[39m npm info @astrojs/rss 🦋 �[36minfo�[39m npm info create-astro 🦋 �[36minfo�[39m npm info @astrojs/alpinejs 🦋 �[36minfo�[39m npm info @astrojs/cloudflare 🦋 �[36minfo�[39m npm info @astrojs/deno 🦋 �[36minfo�[39m npm info @astrojs/image 🦋 �[36minfo�[39m npm info @astrojs/lit 🦋 �[36minfo�[39m npm info @astrojs/mdx 🦋 �[36minfo�[39m npm info @astrojs/netlify 🦋 �[36minfo�[39m npm info @astrojs/node 🦋 �[36minfo�[39m npm info @astrojs/partytown 🦋 �[36minfo�[39m npm info @astrojs/preact 🦋 �[36minfo�[39m npm info @astrojs/prefetch 🦋 �[36minfo�[39m npm info @astrojs/react 🦋 �[36minfo�[39m npm info @astrojs/sitemap 🦋 �[36minfo�[39m npm info @astrojs/solid-js 🦋 �[36minfo�[39m npm info @astrojs/svelte 🦋 �[36minfo�[39m npm info @astrojs/tailwind 🦋 �[36minfo�[39m npm info @astrojs/turbolinks 🦋 �[36minfo�[39m npm info @astrojs/vercel 🦋 �[36minfo�[39m npm info @astrojs/vue 🦋 �[36minfo�[39m npm info @astrojs/markdown-component 🦋 �[36minfo�[39m npm info @astrojs/markdown-remark 🦋 �[36minfo�[39m npm info @astrojs/telemetry 🦋 �[36minfo�[39m npm info @astrojs/webapi 🦋 �[33mwarn�[39m astro is not being published because version 1.6.4 is already published on npm 🦋 �[33mwarn�[39m @astrojs/prism is not being published because version 1.0.2 is already published on npm 🦋 �[33mwarn�[39m @astrojs/rss is not being published because version 1.0.3 is already published on npm 🦋 �[33mwarn�[39m create-astro is not being published because version 1.2.1 is already published on npm 🦋 �[33mwarn�[39m @astrojs/alpinejs is not being published because version 0.1.2 is already published on npm 🦋 �[33mwarn�[39m @astrojs/cloudflare is not being published because version 4.0.0 is already published on npm 🦋 �[33mwarn�[39m @astrojs/deno is not being published because version 2.0.0 is already published on npm 🦋 �[36minfo�[39m @astrojs/image is being published because our local version (0.0.0-vercel-image-20221108134223) has not been published on npm 🦋 �[33mwarn�[39m @astrojs/lit is not being published because version 1.0.1 is already published on npm 🦋 �[33mwarn�[39m @astrojs/mdx is not being published because version 0.11.5 is already published on npm 🦋 �[33mwarn�[39m @astrojs/netlify is not being published because version 1.2.0 is already published on npm 🦋 �[33mwarn�[39m @astrojs/node is not being published because version 3.0.0 is already published on npm 🦋 �[33mwarn�[39m @astrojs/partytown is not being published because version 1.0.1 is already published on npm 🦋 �[33mwarn�[39m @astrojs/preact is not being published because version 1.2.0 is already published on npm 🦋 �[33mwarn�[39m @astrojs/prefetch is not being published because version 0.1.1 is already published on npm 🦋 �[33mwarn�[39m @astrojs/react is not being published because version 1.2.2 is already published on npm 🦋 �[33mwarn�[39m @astrojs/sitemap is not being published because version 1.0.0 is already published on npm 🦋 �[33mwarn�[39m @astrojs/solid-js is not being published because version 1.2.2 is already published on npm 🦋 �[33mwarn�[39m @astrojs/svelte is not being published because version 1.0.2 is already published on npm 🦋 �[33mwarn�[39m @astrojs/tailwind is not being published because version 2.1.2 is already published on npm 🦋 �[33mwarn�[39m @astrojs/turbolinks is not being published because version 0.1.4 is already published on npm 🦋 �[33mwarn�[39m @astrojs/vercel is not being published because version 2.3.3 is already published on npm 🦋 �[33mwarn�[39m @astrojs/vue is not being published because version 1.2.1 is already published on npm 🦋 �[33mwarn�[39m @astrojs/markdown-component is not being published because version 1.0.2 is already published on npm 🦋 �[33mwarn�[39m @astrojs/markdown-remark is not being published because version 1.1.3 is already published on npm 🦋 �[33mwarn�[39m @astrojs/telemetry is not being published because version 1.0.1 is already published on npm 🦋 �[33mwarn�[39m @astrojs/webapi is not being published because version 1.1.1 is already published on npm 🦋 �[36minfo�[39m Publishing �[36m"@astrojs/image"�[39m at �[32m"0.0.0-vercel-image-20221108134223"�[39m 🦋 �[32msuccess�[39m packages published successfully: 🦋 @astrojs/image@0.0.0-vercel-image-20221108134223 🦋 Creating git tag... 🦋 New tag: @astrojs/image@0.0.0-vercel-image-20221108134223

@matthewp
Copy link
Contributor Author

matthewp commented Nov 8, 2022

@tony-sull The problem is because of this line:

'./node_modules/@astrojs/image/dist/vendor/squoosh/image-pool.js'

It's not able to find that file to launch as a worker. I'm not 100% sure why; my guess would be that the cwd is not relative to node_modules perhaps. For Vercel it might be inside of their .vercel folder instead.

The fix is to make image-pool.js it's own separate bundle (chunk) and then launch itself as a worker instead, see here:

Here's a demo app example

Copy link
Contributor

@tony-sull tony-sull left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excellent fix!

Really interesting to see that the build output ends up in different locations in the hosted build, not sure the right way to test that as part of our CI 🤔

@matthewp matthewp merged commit d701ae0 into main Nov 8, 2022
@matthewp matthewp deleted the image-vercel branch November 8, 2022 16:14
@astrobot-houston astrobot-houston mentioned this pull request Nov 8, 2022
matthewp added a commit that referenced this pull request Nov 8, 2022
* Allow image-pool to be used as its own Worker

* Adding a changeset

* fix image tests

* update picture tests

* Pass the current URL
matthewp added a commit that referenced this pull request Nov 10, 2022
matthewp added a commit that referenced this pull request Nov 11, 2022
* Revert "Allow image-pool to be used as its own Worker (#5317)"

This reverts commit d701ae0.

* Adding a changeset

* Remove diff

* Remove unused code
matthewp added a commit that referenced this pull request Nov 11, 2022
matthewp added a commit that referenced this pull request Nov 14, 2022
* Revert "Revert "Allow image-pool to be used as its own Worker (#5317)" (#5360)"

This reverts commit 20e60c6.

* Remove special image-pool.js moving around

* Merge in assetIncludes

* changeset

* Copy to chunk folder in SSR too

* Update tidy-shoes-yawn.md
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pkg: integration Related to any renderer integration (scope)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

@astrojs/image works locally but not on Netlify Edge @astrojs/image works locally but not on Vercel
3 participants