- Updated dependencies
- Updated
package.json
engines.node
property to reflect changes from v7
- Fixed order of preference for bucket name resolution so passed
bucket
param can override theARC_STATIC_BUCKET
env var; thanks @andybee! - Updated dependencies
- Updated
aws-lite
- Fixed issue loading assets from S3
- 7.0.1 - 7.0.2 were temporary reversions to 6.0.6 to prevent any critical production issues
- ASAP just got a lot faster courtesy of aws-lite!
- As such, ASAP no longer relies on
aws-sdk
/@aws-sdk/s3
- Added Node.js 20.x to test matrix
- Breaking change: removed support for Node.js 14.x (now EOL, and no longer available to created in AWS Lambda)
- Added JPEG2000 file format support; fixes #1474
- Fixed AVIF file format support; thanks @jessehattabaugh
- Added AVIF file format support
- Clean up SPA config a bit; ensure
ARC_STATIC_SPA=true
enables SPA; thanks @busticated!
- Added fonts to binary mime types; thanks @sjorsrijsdam!
- Ensure improper casing does not result in false-positive local file reads; thanks @andybee!
- Fixed 304 (not modified) returns in
nodejs18.x
with AWS SDK v3
- AWS has deprecated Lambda
nodejs12.x
;@architect/asap
6.0 now assumesnodejs14.x
or higher - Updated AWS SDK versions to sync up with the rest of Architect following v10.12
- Added some additional binary media types
- Fixed invalid S3 data returns in
nodejs18.x
with AWS SDK v3
- Added support for Lambda's new
nodejs18.x
runtime, and AWS SDK v3 (@aws-sdk/*
)- 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)
- To opt in, simply upgrade
- Added Node.js 18.x to test coverage
- Updated dependencies
- Fix semi-obscure case where ASAP is expected to work locally without
aws-sdk
installed
- Deep require
aws-sdk
S3 client for a potentially large cold start perf boost- In small-scale testing, we found this reduces cold start performance by 2-3x, averaging ~150ms on Lambda
- Breaking change: Architect no longer automatically populates, relies on, or makes direct use of
NODE_ENV
,ARC_CLOUDFORMATION
,ARC_HTTP
, orARC_SANDBOX_PATH_TO_STATIC
env vars.@architect/asap
v5+ now requires Architect v10 / Sandbox v5 or later. - Stop publishing to the GitHub Package registry
- Updated dependencies
- Added
env
option for manually specifyingtesting
environment use;- Leaving undocumented for now as it's likely only practical use is as an internal option for Sandbox
- Added
sandboxPath
option for manually specifying thetesting
environment's Sandbox static asset folder- This helps us deprecate a very old Sandbox-only internal env var that was used in place of properly passing parameters to ASAP
- Also leaving this undocumented for now, for the same reasons as above
- Added support for
ARC_ENV
(in favor ofNODE_ENV
)
- Updated dependencies
- Removed support for
ARC_STATIC_FOLDER
(deprecated 2020-06-07; should not have made it to ASAP v4)
ASAP comes into its own! 🎉
- ASAP is now fully independent of
@architect/functions
as of version4.0.0
of both packages - Except as noted below, ASAP is a drop-in replacement for
arc.http.proxy
calls and usage - no fuss, no muss! - For posterity, all related legacy changelog entries can be found below
- ASAP is leaner, meaner (and when necessary, more easy to debug in production)
- ASAP 3.x: 233KB
- ASAP 4.x: 70KB (-70%!)
- Potentially breaking change: when used in projects without a defined root handler, ASAP now defaults to non-SPA mode
- To re-enable SPA, set the
ARC_STATIC_SPA
env var in your project environment totrue
- To re-enable SPA, set the
- Potentially breaking change: static assets not managed by Architect, but delivered via an Architect + ASAP app must have S3
ContentType
property set- S3
ContentType
is normally automatically set if your static assets are managed by Architect - However, if you publish / deliver static assets outside your Architect deploy workflow and deliver them via ASAP, ensure you are setting the
ContentType
(i.e. MIME type) property on your S3 asset - If you do not, your assets will be defaulted to
content-type: application/octet-stream
- This is a super obscure case, but just a heads up!
- S3
- 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 Architect 5 (and lower)
- Breaking change: removed undocumented
asap.read
method - Breaking change: removed undocumented proxy plugin interface
- Normalized headers to lowercase for full HTTP 2 compatibility
- Updated dependencies
- Fixed bad call in
http.proxy
alias config
- 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
- 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!
arc.http.proxy
now supports API Gateway HTTP APIs request/response payload V2
arc.http.proxy
looks for defaultindex.html
whenARC_STATIC_SPA=false
- Fixes broken response when bucket is not configured as root proxy
- 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
- 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)
- 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
- Fixes
arc.http
/arc.http.async
responses to/{proxy+}
requests
- Added ability to set custom headers on any
arc.http.proxy
request
- Fixed bug preventing emitting binary assets via
arc.http.proxy
- Fixed munged headers and content-type in proxy plugins, fixes @architect/architect#432
proxy.read()
calls withoutconfig.bucket
specified work correctly again, fixes #38
- 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
- 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:
- 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.
- 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()