fix: upgrade posthog-node to v5 to fix Worker axios bundling failure#128
Merged
Conversation
The cloudflare_module Worker deploy kept failing with
`Could not resolve "axios"`: posthog-node v4 (pulled in transitively by
nuxt-posthog) does a dynamic require("axios") that Nitro leaves as an
unresolvable external in server.mjs. The earlier externals.inline hack
did not work because it is a runtime require.
posthog-node v5 dropped axios entirely (uses native fetch, which is
Workers-native). Pin it via a pnpm override; nuxt-posthog's server
usage (new PostHog/reloadFeatureFlags/getAllFlagsAndPayloads) is
unchanged in v5. Also revert the now-useless externals.inline axios
entry. Remaining axios in the lockfile is only via the wait-on
devDependency and is never bundled into the server.
https://claude.ai/code/session_012YWscdohmouZHhZ7otKnqh
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
launchpad | fd689e4 | Commit Preview URL Branch Preview URL |
May 15 2026, 09:16 PM |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The
cloudflare_moduleWorker deploy ("Workers Builds: launchpad") keeps failing with:Root cause:
posthog-nodev4 (pulled in transitively bynuxt-posthog) does a dynamicrequire("axios"). Nitro/Rollup cannot statically inline a runtime require, so it stays as an external require inserver.mjs, and wrangler's esbuild can't resolve it (nonode_modulesin.output). The earlierexternals.inlinehack from #126 did not work for exactly this reason.posthog-nodev5 dropped axios entirely and uses nativefetch(Workers-native), eliminating the require.Changes
posthog-nodeto^5.8.4via override (it is transitive vianuxt-posthog@1.6.3; resolves to 5.34.2).externals.inline: ["axios"]back to["@nuxt/content"].Compatibility
nuxt-posthog@1.6.3's server plugin only usesnew PostHog(key, { host }),reloadFeatureFlags()andgetAllFlagsAndPayloads()— all unchanged in posthog-node v5. The remainingaxiosin the lockfile comes only from thewait-ondevDependency and is never bundled into the server.Test plan
Could not resolve "axios"https://claude.ai/code/session_012YWscdohmouZHhZ7otKnqh
Generated by Claude Code