Security News
pnpm 10.0.0 Blocks Lifecycle Scripts by Default
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
@dealmore/apollo-link-lambda
Advanced tools
Apollo transport link for directly invoking AWS Lambda functions
When your GraphQL endpoint is served by an AWS Lambda function, this Apollo link can be used as an in-place replacement for the HTTPLink. Instead of sending the GraphQL request over HTTP and API Gateway to your Lambda it uses the JavaScript AWS SDK to invoke the GraphQL Lambda directly.
This reduces the network overhead and costs because the requests are routed inside of AWS rather than over the public internet. Internally it creates an invoke event that has the same schema as an API Gateway proxy event.
✅ Support for @apollo/client
3.0+
✅ Fully compatible to HTTPLink
✅ Support for AWS API Gateway Events 1.0 & 2.0
npm i --save @dealmore/apollo-link-lambda # npm or
yarn add @dealmore/apollo-link-lambda # yarn
Please note that this package has peerDependencies to
@apollo/client
,aws-sdk
andgraphql
. So you might need to install this packages too if they are not already installed.
import { ApolloClient, InMemoryCache, createHttpLink } from '@apollo/client';
import { createLambdaLink } from '@dealmore/apollo-link-lambda';
const isServer = typeof window === 'undefined';
const client = new ApolloClient({
ssrMode: isServer,
link: isServer
? createLambdaLink({
functionName: 'MyLambdaFunc',
})
: createHttpLink({
uri:
'https://psot142kj1.execute-api.eu-central-1.amazonaws.com/graphql',
}),
cache: new InMemoryCache(),
});
Option | Default | Description |
---|---|---|
functionName | (required) | The name of the Lambda function. Possible name formats:
|
httpMethod | POST | Sets the type of HTTP method for the invoke event. Possible values:
|
payloadFormatVersion | 1.0 | Sets the payload format version. Possible values:
|
headers | {} | You can add custom headers here that should be included in every request.{ "key": "value" } |
lambda | void | Allows to pass in a pre configured Lambda instance. |
To invoke the GraphQL Lambda function make sure that associated AWS account or the AWS role of the client has the permission for the lambda:InvokeFunction
action:
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "InvokeLambda",
"Effect": "Allow",
"Action": "lambda:InvokeFunction",
"Resource": "arn:aws:lambda:*:*:function:MyLambdaFunc"
}
]
}
MIT - see LICENSE for details.
FAQs
Apollo transport link for directly invoking AWS Lambda functions
We found that @dealmore/apollo-link-lambda demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
Product
Socket now supports uv.lock files to ensure consistent, secure dependency resolution for Python projects and enhance supply chain security.
Research
Security News
Socket researchers have discovered multiple malicious npm packages targeting Solana private keys, abusing Gmail to exfiltrate the data and drain Solana wallets.