Skip to content


Interact with linked resources in your functions in a typesafe way.

The JS SDK is an npm package that allows you to access linked resources in your functions and frontends in a typesafe way.

Currently, the SDK is only available for JavaScript and TypeScript. Support for other languages is coming soon.


Install the npm package.

Terminal window
npm install sst@ion


Import Resource to access the linked resources.

import { Resource } from "sst";

Here we are assuming that a bucket has been linked to the function. Here’s what that could look like.

const bucket = new"MyBucket");
new"MyFunction", {
handler: "src/lambda.handler",
link: [bucket]

How it works

In the above example, works because it’s been injected into the function package on sst dev and sst deploy.

For functions, this is injected into the globalThis using esbuild and for frontends, it’s injected into the process.env object.

The JS SDK first checks the process.env and then the globalThis for the linked resources. You can read more about how the links are injected.