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

fix(vercel): support node-fetch and Node 18 fetch #5587

Merged
merged 1 commit into from
Dec 12, 2022
Merged

Conversation

JuanM04
Copy link
Contributor

@JuanM04 JuanM04 commented Dec 12, 2022

Changes

Fixes #5568
Fixes #5463

When running Node.js v18+, the official fetch implementation is used, but when Node.js v14 and v16 is used, node-fetch is used. To fix this, I've split the code that transform from Node's HTTP Server to/from WebAPI into two: one for node-fetch and another to Node's fetch.

This separation could be removed in the future when we stop supporting Node v14, since undici polyfills fetch as the standard dictates

Testing

Docs

@changeset-bot
Copy link

changeset-bot bot commented Dec 12, 2022

🦋 Changeset detected

Latest commit: 76d076c

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 Dec 12, 2022
@JuanM04
Copy link
Contributor Author

JuanM04 commented Dec 12, 2022

!preview set-cookie

@github-actions
Copy link
Contributor

 > root@0.0.0 release /home/runner/work/astro/astro > pnpm run build && changeset publish "--tag" "next--set-cookie" > 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 �[2m2577e266b473c556�[0m �[33m@astrojs/telemetry:build: �[0mcache hit, suppressing output �[2m71e5575f48d4c35a�[0m �[34mcreate-astro:build: �[0mcache hit, suppressing output �[2m6429748457a15926�[0m �[36m@astrojs/prism:build: �[0mcache hit, suppressing output �[2meed4d8a03b1287a8�[0m �[35m@astrojs/markdown-remark:build: �[0mcache hit, suppressing output �[2m5088df81794de4ca�[0m �[32mastro:build: �[0mcache hit, suppressing output �[2mec25580500f550b3�[0m �[34m@astrojs/turbolinks:build: �[0mcache hit, suppressing output �[2mfd8eafe582f0cf04�[0m �[35m@astrojs/svelte:build: �[0mcache hit, suppressing output �[2m7a15f5af9f7e0f5e�[0m �[32m@astrojs/vue:build: �[0mcache hit, suppressing output �[2m69cb8125c28c656d�[0m �[36m@astrojs/sitemap:build: �[0mcache hit, suppressing output �[2m5f14d25a453e2785�[0m �[34m@astrojs/lit:build: �[0mcache hit, suppressing output �[2ma54b6df3c42bda3f�[0m �[36m@astrojs/node:build: �[0mcache hit, suppressing output �[2m38ec5e1c325d3eab�[0m �[32m@astrojs/netlify:build: �[0mcache hit, suppressing output �[2m5f19e23efc6df16e�[0m �[35m@astrojs/cloudflare:build: �[0mcache hit, suppressing output �[2mddbf178a3c8c50c9�[0m �[34m@astrojs/react:build: �[0mcache hit, suppressing output �[2ma0b3cfe83e112b71�[0m �[35m@astrojs/solid-js:build: �[0mcache hit, suppressing output �[2mc27860667ad95ad7�[0m �[33m@astrojs/partytown:build: �[0mcache hit, suppressing output �[2med544f9768752e02�[0m �[34m@astrojs/tailwind:build: �[0mcache hit, suppressing output �[2m48b654ca7f5413d2�[0m �[36m@astrojs/prefetch:build: �[0mcache hit, suppressing output �[2m4758f32fc94e30b3�[0m �[33m@astrojs/preact:build: �[0mcache hit, suppressing output �[2mf5b9a0088de8a7d3�[0m �[32m@astrojs/alpinejs:build: �[0mcache hit, suppressing output �[2m5d022d875cd300ea�[0m �[35m@astrojs/rss:build: �[0mcache hit, suppressing output �[2md8f07e54d5822654�[0m �[33m@astrojs/deno:build: �[0mcache hit, suppressing output �[2mc968aff75872da20�[0m �[33m@astrojs/mdx:build: �[0mcache hit, suppressing output �[2m7b0a39f7d517504d�[0m �[33m@astrojs/image:build: �[0mcache hit, suppressing output �[2m54e7f27508dd0f14�[0m �[32m@astrojs/vercel:build: �[0mcache miss, executing �[2mac731487a72aa9ac�[0m �[32m@astrojs/vercel:build: �[0m �[32m@astrojs/vercel:build: �[0m> @astrojs/vercel@0.0.0-set-cookie-20221212172245 build /home/runner/work/astro/astro/packages/integrations/vercel �[32m@astrojs/vercel:build: �[0m> astro-scripts build "src/**/*.ts" && tsc �[32m@astrojs/vercel:build: �[0m Tasks: 26 successful, 26 total Cached: 25 cached, 26 total Time: 3.83s 🦋 �[33mwarn�[39m �[31m===============================IMPORTANT!===============================�[39m 🦋 �[33mwarn�[39m Packages will be released under the next--set-cookie 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.15 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.1.0 is already published on npm 🦋 �[33mwarn�[39m create-astro is not being published because version 1.2.3 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.1.1 is already published on npm 🦋 �[33mwarn�[39m @astrojs/deno is not being published because version 2.0.1 is already published on npm 🦋 �[33mwarn�[39m @astrojs/image is not being published because version 0.12.1 is already 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.12.2 is already published on npm 🦋 �[33mwarn�[39m @astrojs/netlify is not being published because version 1.2.2 is already published on npm 🦋 �[33mwarn�[39m @astrojs/node is not being published because version 3.1.1 is already published on npm 🦋 �[33mwarn�[39m @astrojs/partytown is not being published because version 1.0.2 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.3 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.3 is already published on npm 🦋 �[33mwarn�[39m @astrojs/turbolinks is not being published because version 0.1.4 is already published on npm 🦋 �[36minfo�[39m @astrojs/vercel is being published because our local version (0.0.0-set-cookie-20221212172245) has not been published on npm 🦋 �[33mwarn�[39m @astrojs/vue is not being published because version 1.2.2 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/vercel"�[39m at �[32m"0.0.0-set-cookie-20221212172245"�[39m 🦋 �[32msuccess�[39m packages published successfully: 🦋 @astrojs/vercel@0.0.0-set-cookie-20221212172245 🦋 Creating git tag... 🦋 New tag: @astrojs/vercel@0.0.0-set-cookie-20221212172245

@matthewp
Copy link
Contributor

@JuanM04 this looks safe to release to me. Would rather get a fix in now than wait for someone to test it out if they are not around to try it.

@JuanM04 JuanM04 merged commit 4d9ef23 into main Dec 12, 2022
@JuanM04 JuanM04 deleted the fix/fetch-vercel branch December 12, 2022 19:45
@astrobot-houston astrobot-houston mentioned this pull request Dec 12, 2022
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/vercel: 2.3.5 breaks API endpoints @astro/vercel breaks when returning a body string
2 participants