Skip to content

refactor(svelte-netlify): replace the archived Lambda proxy with gateway - #5304

Merged
ReneWerner87 merged 2 commits into
masterfrom
claude/svelte-netlify-drop-archived-proxy
Aug 1, 2026
Merged

refactor(svelte-netlify): replace the archived Lambda proxy with gateway#5304
ReneWerner87 merged 2 commits into
masterfrom
claude/svelte-netlify-drop-archived-proxy

Conversation

@ReneWerner87

@ReneWerner87 ReneWerner87 commented Aug 1, 2026

Copy link
Copy Markdown
Member

Companion to #5303, which removes the other user of the archived library.

github.com/awslabs/aws-lambda-go-api-proxy was archived on 21 May 2025. This recipe used its core package through a local 109-line Fiber v3 adapter, since the library's own Fiber adapter only ever supported Fiber v2.

Why not Lambda Web Adapter

The official successor is Lambda Web Adapter, which is the right answer for aws-sam-container. It is not an option here: it ships as a Lambda layer (AWS_LAMBDA_EXEC_WRAPPER=/opt/bootstrap) or a container extension (/opt/extensions/lambda-adapter), and Netlify Functions support neither.

github.com/carlmjohnson/gateway is a maintained drop-in for http.ListenAndServe on Lambda. It decodes the same events.APIGatewayProxyRequest payload Netlify delivers, so it fits without changing the deployment model at all.

Import path: the repository was renamed to earthboundkid/gateway, but its go.mod still declares github.com/carlmjohnson/gateway. That is the path to import.

What changed

Fiber v3 already exposes an app as an http.Handler via middleware/adaptor, so the local adapter package is no longer needed and is removed. main.go drops from an init / Handler / lambda.Start arrangement to a single call:

log.Fatal(gateway.ListenAndServe("n/a", adaptor.FiberApp(app)))

build.sh, netlify.toml and the /api/* redirect are untouched.

Note on that first argument, since it reads oddly and was raised in review: despite the function name it is not a listen address and is never parsed as one. It is only used as a fallback Host for the constructed request when the event does not carry one. "n/a" is the value from the library's own README example.

Side effect: the module-graph noise is gone

The archived library bundled adapters for gin, chi, fiber v2, gorilla/mux, iris, echo and negroni in a single go.mod, so importing any part of it pulled the entire framework list into the consumer's module graph. go list -m no longer knows any of these:

Module Advisories
github.com/awslabs/aws-lambda-go-api-proxy (the archived library itself)
github.com/gofiber/fiber/v2 2.52.1 11, two Critical
github.com/gomarkdown/markdown 4
github.com/go-chi/chi/v5 5.0.8 3
github.com/sirupsen/logrus 1.8.1 2

None of them were ever compiled into the binary, no go.sum entries and go mod why reported main module does not need module for each, but they were reported by anything resolving the module graph rather than the build list. This removes them at the source rather than papering over them with a replace directive, which is what #5300 attempted before being closed.

Verification

  • go build ./... passes
  • go vet ./... passes
  • OSV scan of the module: 19 packages, 0 vulnerabilities
  • go list -m confirms all five modules above are gone

Not verified: an actual Netlify deploy, which needs an account and a live build. The payload type gateway decodes (events.APIGatewayProxyRequest) is the same one the previous code received, so the wire contract is unchanged.

Unrelated, worth knowing

Netlify is deprecating Lambda compatibility mode:

Lambda compatibility mode is deprecated. As of July 1, 2027, deploys containing functions in this mode will no longer be accepted.

So this recipe will eventually need porting to the modern Netlify Functions API regardless. That is a separate piece of work and out of scope here.

Summary by CodeRabbit

  • Refactor
    • Updated the gateway to run as a standard HTTP server.
    • Removed AWS Lambda-based request handling and its associated adapter.
    • Existing static, root, and geolocation routes remain available.
  • Documentation
    • Updated project structure documentation to reflect the removal of the adapter.

github.com/awslabs/aws-lambda-go-api-proxy was archived on 21 May 2025.
This recipe used its core package through a local 109-line Fiber v3
adapter, since the library's own Fiber adapter only supports Fiber v2.

The official successor, Lambda Web Adapter, is not an option here: it
ships as a Lambda layer or container extension and Netlify Functions
support neither. github.com/carlmjohnson/gateway is a maintained
drop-in for http.ListenAndServe on Lambda that decodes the same
events.APIGatewayProxyRequest payload Netlify delivers, so it fits
without changing the deployment model.

Fiber v3 already exposes an app as an http.Handler via
middleware/adaptor, so the local adapter package is no longer needed and
is removed. main.go drops from an init/Handler/lambda.Start arrangement
to a single gateway.ListenAndServe call.

Note the import path: the repository was renamed to earthboundkid/gateway
but its go.mod still declares github.com/carlmjohnson/gateway, so that is
the path to import.

This also clears the module-graph noise that came with the archived
library. It bundled adapters for gin, chi, fiber v2, gorilla/mux, iris,
echo and negroni in a single go.mod, so importing any part of it pulled
the whole framework list into the graph. Gone from `go list -m` now:

  github.com/awslabs/aws-lambda-go-api-proxy
  github.com/gofiber/fiber/v2       (11 advisories, 2 critical)
  github.com/gomarkdown/markdown    (4 advisories)
  github.com/go-chi/chi/v5          (3 advisories)
  github.com/sirupsen/logrus        (2 advisories)

None of those were ever compiled into the binary, but they were reported
by anything resolving the module graph. This removes them at the source
instead of papering over them with a replace directive.

`go build ./...`, `go vet ./...` and an OSV scan of the module all pass.
The Netlify build script, netlify.toml and the redirect are unchanged.
Copilot AI review requested due to automatic review settings August 1, 2026 11:44

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR refactors the svelte-netlify recipe to remove the archived aws-lambda-go-api-proxy dependency (and the local Fiber adapter built on top of it) by switching the Lambda entrypoint to github.com/carlmjohnson/gateway, leveraging Fiber v3’s adaptor to expose the app as an http.Handler.

Changes:

  • Replace the custom Lambda handler/adapter approach with gateway.ListenAndServe(..., adaptor.FiberApp(app)).
  • Remove the local adapter/ package and drop the archived proxy library from the module graph.
  • Update go.mod/go.sum and docs to reflect the new structure/dependencies.

Reviewed changes

Copilot reviewed 4 out of 5 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
svelte-netlify/cmd/gateway/main.go Switch Lambda entrypoint to gateway + Fiber v3 adaptor
svelte-netlify/adapter/adapter.go Remove custom adapter (no longer needed)
svelte-netlify/go.mod Drop archived dependency; add gateway; tidy direct/indirect deps
svelte-netlify/go.sum Remove archived dependency sums and associated transitive noise
svelte-netlify/README.md Update project structure docs to remove adapter/

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread svelte-netlify/cmd/gateway/main.go
@coderabbitai

coderabbitai Bot commented Aug 1, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

The PR removes the Fiber-to-AWS Lambda adapter and Lambda handler. The gateway now serves the existing Fiber routes through gateway.ListenAndServe and Fiber’s HTTP adapter. The README no longer documents the removed adapter directory.

Changes

Gateway runtime migration

Layer / File(s) Summary
Serve Fiber through the HTTP gateway
svelte-netlify/cmd/gateway/main.go, svelte-netlify/adapter/adapter.go
The gateway removes Lambda setup and serves the Fiber app through gateway.ListenAndServe with adaptor.FiberApp. The AWS Lambda adapter file and its public API are removed.
Update project structure documentation
svelte-netlify/README.md
The README removes the adapter/ directory entry.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

Suggested reviewers: copilot

Poem

A rabbit hops where Lambda flew,
The Fiber app now serves anew.
Through gateway paths, the routes align,
No adapter burrow marks the line.
The README trims its map with care.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes replacing the archived Lambda proxy with the gateway implementation.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch claude/svelte-netlify-drop-archived-proxy

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@ReneWerner87
ReneWerner87 enabled auto-merge August 1, 2026 11:49
@ReneWerner87
ReneWerner87 disabled auto-merge August 1, 2026 11:50
@ReneWerner87
ReneWerner87 enabled auto-merge August 1, 2026 11:51
The comment said the host argument is unused on Lambda, which is
imprecise. It is never parsed as a listen address, but it is used as a
fallback Host for the constructed request when the API Gateway event does
not carry one.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 4 out of 5 changed files in this pull request and generated no new comments.

@ReneWerner87
ReneWerner87 disabled auto-merge August 1, 2026 11:59
@ReneWerner87
ReneWerner87 merged commit 620dc4b into master Aug 1, 2026
10 checks passed
@ReneWerner87
ReneWerner87 deleted the claude/svelte-netlify-drop-archived-proxy branch August 1, 2026 11:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants