Skip to content

Instantly share code, notes, and snippets.

@thedavidprice
Created September 18, 2021 20:55
Show Gist options
  • Select an option

  • Save thedavidprice/ac67656b1a3e2b32f31799cd4fb7cbec to your computer and use it in GitHub Desktop.

Select an option

Save thedavidprice/ac67656b1a3e2b32f31799cd4fb7cbec to your computer and use it in GitHub Desktop.
RedwoodJS Generated Serverless yml
# See the full yml reference at https://www.serverless.com/framework/docs/providers/aws/guide/serverless.yml/
service: app
# Uncomment org and app if you want to integrate your deployment with the Serverless dashboard. See https://www.serverless.com/framework/docs/dashboard/ for more details.
# org: your-org
# app: your-app
plugins:
- serverless-dotenv-plugin
custom:
dotenv:
include:
- # List the environment variables you want to include from your .env file here.
provider:
name: aws
runtime: nodejs12.x
region: us-east-2 # This is the AWS region where the service will be deployed.
httpApi: # HTTP API is used by default. To learn about the available options in API Gateway, see https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-vs-rest.html
cors: true
payload: '1.0'
stackTags: # Add CloudFormation stack tags here
source: serverless
name: Redwood Lambda API with HTTP API Gateway
tags: # Add service wide tags here
name: Redwood Lambda API with HTTP API Gateway
package:
individually: true
functions:
graphql:
description: graphql function deployed on AWS Lambda
package:
artifact: api/dist/zipball/graphql.zip # This is the default location of the zip file generated during the deploy command.
memorySize: 1024 # mb
timeout: 25 # seconds (max: 29)
tags: # Tags for this specific lambda function
endpoint: /.netlify/functions/graphql
# Uncomment this section to add environment variables either from the Serverless dotenv plugin or using Serverless params
# environment:
# YOUR_FIRST_ENV_VARIABLE: ${env:YOUR_FIRST_ENV_VARIABLE}
handler: graphql.handler
events:
- httpApi:
path: /.netlify/functions/graphql
method: GET
- httpApi:
path: /.netlify/functions/graphql
method: POST
@thedavidprice
Copy link
Author

  1. These function endpoint references are incorrect:
  • /.netlify/functions/graphql
  • should all be changed to /.redwood/functions
  1. I haven't checked — does this upload all functions in a project and not just graphql.js? It needs to!

  2. It looks like there are more instructions for setting up Prisma
    I just looked at the documentation here "Deploying to AWS Lambda" . It looks like a few things need to happen:

  • reconcile this current guide with the settings/config in this serverless.yml
  • remove the duplicate Prisma binary being deployed following this in the Notes section
package:
  patterns:
    - '!node_modules/.prisma/client/query-engine-*'
    - 'node_modules/.prisma/client/query-engine-rhel-*'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment