Also see: Architect changelog
- Minor performance improvement to
arc.http
binary content type checks; thanks @gyx1000!
- Updated
binaryTypes
array, thanks @MichaelDeBoey!
- Fixed issue where users without the AWS-SDK installed locally or globally would error if
@architect/functions
is required or imported
- Added support for Lambda's new
nodejs18.x
runtime, and AWS SDK v3 (@aws-sdk/*
)- If your Lambdas make use of
@architect/functions
(and you otherwise do not directly rely on AWS SDK calls), you are now likely fully forward-compatible withnodejs18.x
(see caveats below) - However, if your Lambdas do NOT make use of
@architect/functions
, before opting into Lambdanodejs18.x
+ SDK v3 we strongly advise you read: https://arc.codes/aws-sdk-versions - To opt in, simply upgrade
@architect/architect
to 10.8 and change your@aws runtime
setting tonodejs18.x
(learn more at http://arc.codes/docs/en/reference/project-manifest/aws#runtime)
- If your Lambdas make use of
- Added Node.js 18.x to test coverage
- Due to changes in AWS SDK v2 → v3,
arc.tables()._db
+arc.tables()._doc
methods are now slightly different; unfortunately, this is not something@architect/functions
can paper over; see more here - In order to paper over breaking changes in AWS SDK v2 to v3,
@architect/functions
inspect the running Node.js version to follow different code paths to corresponding SDK versions; if your test / CI environment is not using the same Node.js version as your production environment, this may result in unexpected testing issues- For example: your CI environment runs Node.js 18.x, but your Lambda uses
@architect/functions
>= 5.3 and is configured to use 16.x; some methods deep within the SDK may differ, and your tests may break - Unless you are making use of
arc.tables()._db
+arc.tables()._doc
, we think this scenario is pretty unlikely. That said, this is unfortunately not something Architect can control for or prevent, and ultimately falls to AWS to resolve for developers - We can only strongly advise your CI and production environments use the same version of Node.js
- For example: your CI environment runs Node.js 18.x, but your Lambda uses
- Updated dependencies
- Updated dependencies
- Fixed double-encoding issue for
arc.http[async]
responses that are already base64-encoded
- Updated dependencies
ws._api
no longer needs to be initialized by running a WebSocket function
- Return type from ArcTable.get is Promise<Item | undefined>
- Bundled typings for public API, thanks @camjackson
- tested with
dtslint
in a new GitHub workflow
- tested with
- Added automatic brotli (
br
) compression to HTTP API responses; compression will not be applied if any of the following cases are true:- You specify a
content-encoding
header - The requesting client does not request
br
encoding via theaccept-encoding
header - You return anything other than a buffer or string as the body of your response
- You are using a legacy REST API
- You specify a
- Fixed body parsing issue that impacts performance of large request body payloads
- Deep require
aws-sdk
deps for a potentially large cold start perf boost- In small-scale testing, we found this can further reduce cold start performance by 2.5-5x, averaging ~150ms on Lambda
- Fixed usage with custom stack names; fixes #1322, thanks @Lugana707, @pgte
- Enable Functions v5 to be used as a bare module in test suites without setting env vars (see
ARC_ENV
requirement below)- Functions now makes a best-effort attempt to find Sandbox ports via internal SSM
- Relax requirement for
ARC_ENV
env var; backfill it totesting
if not found
@architect/functions
is faster and leaner than ever, now down to about 425KB (from ~950KB). This means even faster cold starts and overall performance!- Added support for Sandbox dynamic port selection
- Added
rawBody
property, handy for use with external libraries that may need access to the raw body contents for things like signing- Moving forward, Arc Functions consumers should consider the
isBase64Encoded
property to correspond only torawBody
, and to be unrelated to thebody
property - See also: the change below re. base64 decoding of
text/plain
+*/xml
bodies
- Moving forward, Arc Functions consumers should consider the
- Breaking change: Architect no longer automatically populates, relies on, or makes direct use of
NODE_ENV
orARC_CLOUDFORMATION
env vars.@architect/functions
v5+ now requires Architect v10 / Sandbox v5 or later.- Added top-level check for correct minimum version, fixes #1313; thanks @monkbroc!
- Breaking change: removed support for legacy Sandbox
@ws
internals, requiring Sandbox v5 - Breaking change: removed
http.express
method, which was badly out of date and broadly unused- Before this change,
@architect/functions
had 19 dependencies and weighed in at ~950KB; after it has 12 dependencies (down 7), and weighs about 475KB, for about a 50% reduction!
- Before this change,
- Breaking change: removed deprecated methods:
arc.http.middleware
(deprecated August 2019) is nowarc.http.async
arc.http.helpers.static
(deprecated June 2019) is nowarc.static
- Breaking change: removed
arc.tables.doc
+arc.tables.db
methods- These methods are still available after table instantiation like so:
let { _doc, _db} = await arc.tables()
- This change enables Architect Functions to only load
aws-sdk
when absolutely necessary, making it 20-30x faster to run in Lambda for usage that does not rely on DynamoDB
- These methods are still available after table instantiation like so:
- Stop publishing to the GitHub Package registry
- Added checks to ensure there are no mysterious failures when required env vars are not present
- Preference for
ARC_*
namespaced env vars:ARC_SESSION_TABLE_NAME
>SESSION_TABLE_NAME
ARC_SESSION_TTL
>SESSION_TTL
ARC_SESSION_DOMAIN
>SESSION_DOMAIN
- All non-namespaced names will continue to be supported until at least Architect 11; we suggest changing them over to the namespaced equivalents as soon as is convenient
- Architect Functions now fails gracefully in Architect 10+ / Sandbox 5+
- Base 64 decodes
text/plain
,text/xml
andapplication/xml
payloads based offContent-Type
- Fix crash on missing
ARC_WSS_URL
env var when@ws
is defined in a project
- Added
ws.close
andws.info
to close a WebSocket and get connection info. Requires@architect/[email protected]
or higher. - Added
ws._api
a preconfiguredApiGatewayManagementApi
instance. Requires@architect/[email protected]
or higher. ws.send
now leveragesws._api
and falls back to the old version of send in older Sandbox environments
- Enable
tables.scan()
to be used without passing any arguments
- Breaking change:
arc.http.proxy
is now@architect/asap
!- ASAP is now fully independent of
@architect/functions
as of version4.0.0
of both packages- With some minor exceptions, ASAP is a drop-in replacement for
arc.http.proxy
calls and usage - no fuss, no muss! - ASAP is also a faster, leaner implementation (-70% smaller, with zero dependencies)
- With some minor exceptions, ASAP is a drop-in replacement for
@architect/functions
is now significantly (~25%) lighter:@architect/functions
3.x (with deps): ~1.1MB@architect/functions
4.x (with deps): ~760KB
- All legacy
@architect/functions
proxy
calls are now removed from this package; this includes:arc.http.proxy
,arc.http.proxy.public
,arc.http.proxy.read
,arc.proxy.public
- Again, just aim those same calls at
@architect/asap
and things should just work - and if they do not, please let us know!
- Again, just aim those same calls at
- ASAP is now fully independent of
- Breaking change: removed support for Node.js 10.x (now EOL, and no longer available to created in AWS Lambda)
- Breaking change: removed support for handling requests from Architect 5 (and lower) APIs
- Responding to requests has not changed, however! Old response semantics from Architect 5 (and lower) will continue to be supported, so you'll always have a clear, clean upgrade path from older Architect projects to newer APIs
- Normalized headers to lowercase for full HTTP 2 compatibility
- Updated dependencies
- Fixed an issue in sandbox where table names containing other table names would get the table definitions confused; thanks @reconbot!
- New
arc.services()
API for retrieving the service map object for a given app; this object contains metadata associated with all infrastructure or services leveraged by the app
- Removed unnecessary console logging for
@events
+@queues
publishing
- Restored
req.path
convenience parameter missing from HTTP APIs; thanks @crtr0!
- Session cookie's SameSite value is configurable with ARC_SESSION_SAME_SITE environment variable; thanks @activescott!
- Fixed issue with
arc.tables()
not generating a client for tables with the stringproduction
in their names in a Sandbox context
- Added new alias for
arc.tables()._name
toarc.tables().name
- Fixed
arc.tables()._name
Sandbox mode returning an array instead of a string; thanks @exalted!
- Internal change for JWE token issuance, thanks @lpetre!
- Ensure JWE session helper also uses the ordered last of multiple potential client sessions present in a cookie (if multiple are present)
- Sessions helper now uses the ordered last of multiple potential client sessions present in a cookie (if multiple are present)
- Fixed subtle session bug where attempting to clear a session would retain old session data
- Fixed broken legacy
cookie
response param behavior, restoring behavior of being an alias for setting aset-cookie
header, and not for writing a session
- Fixed rate-limit crashes in legacy
events.publish
call; fixes #300
- Updated session test to no longer use legacy session table name
- Updated dependencies
- Handle body parsing
HTTP
APIs with v2.0 Lambda req payloads that include raw JSON; fixes @architect#997, thanks @mawdesley!
- Return errors on local
@events
+@queues
publishing
- Fixes backward compat for legacy old school tidy Arc response params (e.g.
{ location: '/foo' }
) when used inHTTP
APIs
- Fixes backward compat for legacy super old school content-type based responses (e.g.
{ html: 'foo' }
) when used inHTTP
APIs
- Fixed bad call in
http.proxy
alias config
- Added full forwards compatibility for API Gateway HTTP APIs, including the new v2.0 payload
- HTTP APIs in v2.0 have undocumented support for some funky response formats, so when in v2.0 mode, non-standard responses are passed through with minimal or no mutation
- Added support for passing along
multiValueHeaders
in responses
- Enable proxy to use HTTP APIs running in Lambda v1.0 payload format mode
- Adds support for loading compressed files out of proxy
- Fixed proxy lookup to custom 404 page working locally
- Fixed incorrect filename in proxy 404 error message
- Adds automatic fingerprint upgrading from non-fingerprinted requests; example:
- If
@static fingerprint true
is enabled,<img src=this-is-fine.gif>
will now automatically load/_static/this-is-fine-abc123.gif
- If
- Adds fingerprinting support for pretty URLs and custom 404s in proxy
- Adds support for
ARC_STATIC_PREFIX
env var to provide symmetry with the new@static prefix
setting- The
ARC_STATIC_FOLDER
env var is now considered deprecated, and will be removed in a future (breaking) release
- The
- Added support for leading slashes in build-free templating (e.g.
${arc.static('/this-is-fine.gif')}
)
- Ensures the build-free templating engine always runs, not just when fingerprint is enabled
- Improved default caching behavior for static assets; fixes #273
- Any assets that don't have
cache-control
explicitly set will now default to usingETag
in order to improve the reliability of cache invalidation - HTML & JSON responses still default to anti-caching headers
- Any assets that don't have
- Added path peeking (aka pretty URLs); fixes #269
- URLs delivered via
proxy
no longer require a trailing slash! - Example: to load
/foo/index.html
, you used to have to request/foo/
- Now, if
/foo
is requested,proxy
will automatically try peeking into/foo
to see if it contains/foo/index.html
– if not, it'll 404 as expected
- URLs delivered via
- Added ETag support to Sandbox static asset serving
- Added support for arbitrary static asset config mapping
- Pass proxy
config.assets
astatic.json
-like static asset object
- Pass proxy
- Internal refactoring: cleaned up old
proxy
code paths
- We now ensure CDNs cannot cache
404
responses
arc.http.express
POST request could fail ifreq.body
was null
arc.http.express
POST request could fail ifreq.body
was null
- Adds S3
ContentEncoding
forarc.http.proxy
/arc.http.proxy.read
- This means you can now publish and read larger files out of S3 in the compressed format of your choosing!
- Updated dependencies
- Fixed
arc.http.helpers.url
to now respectARC_LOCAL
flag, thanks @filmaj! - Fixed
arc.tables._name
calls, thanks @filmaj!
- Support for Lambda payload version 2 in session (for API Gateway HTTP APIs)
- Mocks API Gateway's current behavior of not sending a body when response is headers / status code only; fixes #254, /ht @alexbepple
- (Back in the day it used to default to sending
\n
because reasons.)
- (Back in the day it used to default to sending
- Fixed and improved events.subscribe fallback object (handy for local testing)
- Fixed local predicate for
arc.tables
to ensureARC_LOCAL
can speak to live AWS infra
- Calling
static()
with the root path (e.g.static('/')
) now returns/_static/
; thanks Paul! arc.http.proxy
now supports API Gateway HTTP APIs request/response payload V2
- Functions now ensures
NODE_ENV
is one oftesting
,staging
, orproduction
(defaulting totesting
) - Updated dependencies
- Fix for
arc.tables()
returningundefined
- Updates deps
- Improves reliability of using Architect Functions in certain test harnesses that may automatically set
NODE_ENV
- Refactor of internal DynamoDB client instantiation; resolves issues using Functions with some test harnesses (like Jest); fixes #238, thanks @konsumer!
- Fixes issue that caused Sandbox to stall when called via the Architect CLI
- Fixes issue that caused Architect Functions to cause issues in certain test harnesses that may automatically set
NODE_ENV
- Note:
3.7.1
was an erroneous re-publish of3.7.0
, please use3.7.2
- Added support for porting express apps with
arc.http.express
- Added support for running multiple Sandboxes at the same time
- No more conflicting events and ports when running multiple simultaneous local Architect projects!
- Also, you can now manually configure your
@events
port withARC_EVENTS_PORT
, and@tables
port withARC_TABLES_PORT
- Added fallback event object for direct invocation of event functions using
arc.events.subscribe
- Updated tests for Sandbox soon to be setting
ARC_CLOUDFORMATION
env var - Updated dependencies
arc.queues.publish
can now acceptgroupID
for fifo queues- erase session with
return {session: {}, location: '/'}
syntax
- Allow setting session TTL by passing a SESSION_TTL environment variable with the desired TTL in seconds
- Removes
@architect/parser
dep
- Internal change for JWE token issuance
- Local WebSockets (
arc.ws
) calls no longer always send port3333
, and to now support custom ports
- Uses updated
ARC_WSS_URL
env var format (but retains backwards compatibility)
- Adds
stagePath
option toarc.static
for anyone using this with a bare API Gateway configuration- Example:
arc.static('foo.png', {stagePath: true})
- Example:
arc.static
now throws an error if the specified asset is not found- Updated dependencies
- Updated dependencies
- Fixes issue where
events.publish
may sometimes fail with > 10 topics; thanks @dduran1967!
- Internal / testing changes only
arc.http.proxy
looks for defaultindex.html
whenARC_STATIC_SPA=false
- Fixes
arc.ws.send
for apps packaged with@architect/package
1.0.50 or later. AWS changed theApiGatewayMangementApi.postToConnection
interface paramterendpoint
to no longer be suffixed with@connections
- Adds
data.reflect
to get table names
let arc = require('@architect/functions')
// elsewhere in your async function handler:
let data = await arc.tables()
let names = await data.reflect() // returns {arcfilename: 'generated-tablename'}
- Adds anti-caching and body parsing
application/vnd.api+json
; resolves #141, thanks @jkarsrud!
- Fixes broken response when bucket is not configured as root proxy
- Improves error states for missing static configs, 404s, etc.
- Updated dependencies
- Added support for
@static fingerprint true
in root spa / proxy requests- This enables Architect projects to deliver fully fingerprinted static assets while also ensuring that each file is appropriately cached by clients and network infra
- Also includes support for build-free calls between your fingerprinted static assets
- Example: in
public/index.html
, use the following syntax to automatically replace the local / human-friendly filename reference to the deployed fingerprinted filename: ${arc.static('image.png')}
will be automatically replaced byimage-a1c3e5.png
- Or
${STATIC('image.png')}
(which is the same thing, but shoutier) - Note: although those look like JS template literal placeholders, they're intended to live inside non-executed, static files within
public/
(or@static folder foo
)
- Example: in
- Updated dependencies
- Changed static manifest loader to be more bundler friendly
- Fixed issue that may prevent
repl
from working with more recent versions of Functions - Add anti-caching headers to
sandbox
404 response
- Added more consistent and regular entry for proxy:
http.proxy
- This is non-breaking:
http.proxy.public
,http.proxy.read
, and even the olderproxy.public
methods are still available, although are deprecated. We suggest moving to them. http.proxy
does the same as whathttp.proxy.public
used to do; since the vast majority of use was aroundhttp.proxy.public
and nothttp.proxy.read
, it didn't make sense to have such a verbose method signature
- This is non-breaking:
http.proxy
's SPA setting can now be disabled with an env var –ARC_STATIC_SPA = 'false'
(wherefalse
is a string, not a bool)- You can still disable it via configuration as well (
{spa:false}
)
- You can still disable it via configuration as well (
- Lots and lots of tests around
http.proxy
- Better 404 / file missing handling in
sandbox
when usinghttp.proxy
(or loading static assets without@http get /
specified)
- Updated deps
- Restored
http.proxy.public
settings that were erroneously removed in a previous updatebucket.staging
,bucket.production
,bucket.folder
, andcacheControl
are now restored
- Fixes a proxy issue in Architect 5 / LTS projects where SPA requests for pages would not have loaded correctly
- Improved detection of
proxy
andws
when running locally with NODE_ENV not set totesting
, andARC_LOCAL
set
http.proxy
now correctly responds to requests if your environment includes anARC_STATIC_FOLDER
env var
- Internal change to normalize response shapes from
http.proxy.public
+http.proxy.read
- Fixes issue where binary assets delivered via
sandbox
/ root may not be properly encoded - Fixes issue where
http.proxy.public
+http.proxy.read
may not have delivered correctly formatted responses in Architect 5 - Fixed minor issue in
ARC_HTTP
env var check
- Adds
ARC_HTTP
env var check to Arc v5 response formatter
- Fixes
arc.http
/arc.http.async
responses to/{proxy+}
requests
- Makes passing config to
arc.http.proxy
entirely optional
- Added Architect 6 compatibility to
arc.http.async
, the new method name forasync/await
middleware- All
async/await
functions run througharc.http.async
now automatically have client sessions attached and decoded, parsed bodes (if applicable) - Learn more about upgrading to Arc 6 +
arc.http.async
here
- All
- Added ability to set custom headers on any
arc.http.proxy
request
arc.http.middleware
(formerlyarc.middleware
) is nowarc.http.async
- These methods are functionally the same
- The old aliases will remain for a while to come, but we suggest moving any deprecated calls over to their new equivalents by mid-2020
- Fixed minor issue where status code of
302
couldn't be overridden when using bothlocation
andstatusCode
(orstatus
, orcode
) response params - Fixed bug preventing emitting binary assets via
arc.http.proxy
- Fixed munged headers and content-type in proxy plugins, fixes @architect/architect#432
- Fixed
arc.static()
(and deprecatedarc.http.helpers.static()
) calls in Arc 6, fixes #59 /ht @mikemaccana - Fixed sometimes-broken paths to API gateway
- Fixed
arc.tables()
calls in Arc 6
- Support for Architect 6
- Includes complete compatibility for Architect 4 + 5 users:
- If already using Functions, everything should just work!
- If using Arc 5 dependency-free, you can now drop your existing responses into Architect Functions's
res()
and everything should be solid; no signature changes should be required
- Includes complete compatibility for Architect 4 + 5 users:
- Takes over all responsibilities of now-deprecated
@architect/data
- Previous data calls can be accessed with
arc.tables()
- Previous data calls can be accessed with
- Responses now include the same content type aware
Cache-Control
defaults as found in Architect 5- As always, they're able to be overriden with
cacheControl
param (orheaders['Cache-Control']
)
- As always, they're able to be overriden with
- Hopefully nothing breaking – please send feedback on the RC!
- 3.3 RC: architect#57
- Slack: https://architecture-as-text.slack.com
- Including a
headers
object in yourarc.http
response will now set custom headers SESSION_DOMAIN
variable now supported injwe
sessionscontext
is now passed onto each middleware function
- Backwards-compatible refactoring of
events
publishing in preparation for Architect 6 service discovery
- For additional control of your user sessions, you may now define the cookie Domain attribute
- Because this needs to be set consistently across your app's usage of session, set this via the
SESSION_DOMAIN
environment variable
- Because this needs to be set consistently across your app's usage of session, set this via the
- This release is all about improving static asset access!
- Static asset fingerprinting is now built into the static asset helper!
- Enable file fingerprinting in your project by adding
fingerprint true
to your Arc manifests's@static
pramga - If enabled, requesting
styles.css
will return the proper fingerprinted URL (e.g.https://your-bucket.s3.us-west-1.amazonaws.com/styles-1e25d663f6.css
)
- Enable file fingerprinting in your project by adding
- The static asset helper is now a first-class method accessible at:
arc.static('filename.ext')
- File path are still relative to your
public/
dir - Legacy method
arc.http.helpers.static('filename.ext')
will continue to be supported
- File path are still relative to your
- Static helper tests
- Static asset fingerprinting is now built into the static asset helper!
proxy.read()
calls withoutconfig.bucket
specified work correctly again, fixes #38
arc.http.helpers.static()
now usesARC_STATIC_BUCKET
andARC_STATIC_FOLDER
(as introduced in 2.0.16 forarc.proxy.read()
), fixes #37
- Also improves S3 URL handling in
arc.http.helpers.static()
, partially addressing @architect/architect#375 (S3's late-2020 URL format support change)
- Updated dependencies
- Adds support for sending
delaySeconds
parameter on queue publish, closes #36 /ht @bardbachmann
arc.events.subscribe
will now accept anAsyncFunction
- Removes trailing slash from
arc.http.helpers.static()
that breaks URLs when working locally
- Updated dependencies
- Fixes local sandbox publishing events/queues bug introduced in 2.0.8
- Enables both text and binary file transit in newly provisioned Arc apps
- This is NOT a breaking update if you aren't using
proxy.public()
- However, if you use
proxy.public()
, this is a breaking update! - In order to enable binary assets support, Arc Functions now encodes files being emitted via
proxy.public()
for use in Architect 5.6+ apps - If you'd like your existing app that uses
proxy.public()
to serve binary assets, you'll need to re-create your API (or hang tight until we release our forthcoming API migration tool)
- However, if you use
get /
encoding is now properly set when usingconfig.bucket.folder
- Added checks to ensure bucket exists in
proxy.public()
- Requests to unknown files via
proxy.public()
now return a proper 404 response, and not 200 /undefined
- Fixes proxy path prefix check in testing environment
- Found and removed some junk files in the NPM package
- Adds
ARC_STATIC_BUCKET
+ARC_STATIC_FOLDER
env vars for config-reducedproxy.public()
reads
- In
proxy.public()
config, the bucket folder prefix is now respected when working locally
- Cache-control header support for
proxy.public
; if not specified, defaults to:- HTML + JSON:
no-cache, no-store, must-revalidate, max-age=0, s-maxage=0
- Everything else:
max-age=86400
- HTML + JSON:
- Updated dependencies
- Fixed local env check in
queues.publish
/ht @tobytailor
- proxy allows for configurable s3 bucket and folder
- proxied files now return
etag
arc.proxy.public
configuration:spa
- boolean, loadindex.html
at any folder depthssr
- path string of module to load or function for overriding/index.html
alias
- alias paths path (eg.{'/css':'/styles/index.scss'}
)plugins
- per filetype transform plugin pipelines
The companion transform plugins aim to help developers make the transition to browser native esmodules:
@architect/proxy-plugin-jsx
transpiles jsx to preact/react@architect/proxy-plugin-tsx
strips types and transpiles jsx to preact/react@architect/proxy-plugin-mjs-urls
adds/staging
or/production
to imports urls@architect/proxy-plugin-bare-imports
enable bare imports with browser esm
And for fun:
@architect/proxy-plugin-md
markdown to html@architect/proxy-plugin-sass
sass/scss
If you think we're missing a plugin please don't hesitate to ask in the issue tracker!
Complete example project code here.
- arc.js
- arc.css
- arc.html
- arc.text
- arc.xml
- arc.json
- New
arc.proxy
wip proxy get-index to /public when running locally and s3 when running on aws
// exmaple usage in a ws-connected lambda
let arc = require('@architect/functions')
exports.handler = arc.proxy.public()
- New
arc.ws
wip progress for sending web socket messages locally and in the cloud
// exmaple usage in a ws-connected lambda
let WebSocket = require('@architect/functions').ws
exports.handler = async function WebSocketConnected(event) {
let ws = new WebSocket(event)
await ws.send('pong')
return {
statusCode: 200
}
}
- New
arc.middleware
await-based middleware API, see the Architect Documentation