-
Are you certain it's a bug?
Is the issue caused by a plugin?
Are you using the latest version?
Is there an existing issue for this?
Issue descriptionMoments ago, I update my packages to latest version. And trying to learn the app locally. I am getting error: Update from old to newMy env filesService configuration (serverless.yml) contentservice: serverless-aws-graphql-book
package:
individually: true
include:
- src/**
provider:
name: aws
profile: ${env:profile}
runtime: nodejs14.x
stage: ${env:stage}
region: eu-north-1
timeout: 30
apiName: ${self:service.name}-${self:provider.stage}
environment:
ITEM_TABLE: ${self:service}-items-${self:provider.stage}
COGNITO: ${self:service.name}-pool
iamRoleStatements:
- Effect: Allow
Action:
- dynamodb:Query
- dynamodb:PutItem
- dynamodb:UpdateItem
- dynamodb:DeleteItem
- lambda:InvokeFunction # Added this like mentioned above
Resource: 'arn:aws:dynamodb:${opt:region, self:provider.region}:*:table/${self:provider.environment.ITEM_TABLE}'
- Effect: Allow
Action:
- dynamodb:Query
Resource: 'arn:aws:dynamodb:${opt:region, self:provider.region}:*:table/${self:provider.environment.ITEM_TABLE}/index/*'
apiGateway:
shouldStartNameWithService: true
custom:
webpack:
webpackConfig: ./webpack.config.js
includeModules: true
packager: 'npm' # Packager that will be used to package your external modules
warmup:
enabled: true
events:
- schedule: rate(5 minutes)
prewarm: true
concurrency: 1
prune:
automatic: true
number: 5
functions:
graphql:
handler: src/handlers/graphql.default
events:
- http:
path: ${env:api_prefix}/graphql
method: get
cors: true
- http:
path: ${env:api_prefix}/graphql
method: post
cors: true
authorizer: AuthFunction
## Authorization function
AuthFunction:
handler: src/auth/auth.default
## Create user
PreSignUp:
handler: src/handlers/PreSignUp.default
events:
- cognitoUserPool:
pool: ${self:provider.environment.COGNITO}
trigger: PreSignUp
existing: true
resources:
Resources:
ItemsTable:
Type: 'AWS::DynamoDB::Table'
Properties:
AttributeDefinitions:
- AttributeName: PK
AttributeType: S
- AttributeName: SK
AttributeType: S
- AttributeName: GSI1PK
AttributeType: S
- AttributeName: GSI1SK
AttributeType: S
KeySchema:
- AttributeName: PK
KeyType: HASH
- AttributeName: SK
KeyType: RANGE
ProvisionedThroughput:
ReadCapacityUnits: 1
WriteCapacityUnits: 1
GlobalSecondaryIndexes:
- IndexName: GSI1
KeySchema:
- AttributeName: GSI1PK
KeyType: HASH
- AttributeName: GSI1SK
KeyType: RANGE
Projection:
ProjectionType: ALL
ProvisionedThroughput:
ReadCapacityUnits: 1
WriteCapacityUnits: 1
TableName: ${self:provider.environment.ITEM_TABLE}
CognitoUserPool:
Type: AWS::Cognito::UserPool
Properties:
MfaConfiguration: OFF
UserPoolName: ${self:provider.environment.COGNITO}
UsernameAttributes:
- email
Policies:
PasswordPolicy:
MinimumLength: 6
RequireLowercase: False
RequireNumbers: True
RequireSymbols: False
RequireUppercase: True
useDotenv: true
plugins:
- serverless-webpack
- serverless-offline
- serverless-plugin-warmup
- serverless-dotenv-plugin
- serverless-prune-plugin Command name and used flagsnpm run serv Command output"N/A" Environment information{
"name": ".....",
"version": "1.0.1",
"main": "src/handler.js",
"license": "MIT",
"scripts": {
"deploy": "sls deploy --stage development",
"deploy:production": "sls deploy --stage production",
"lint": "eslint src --ext ts,js --no-ignore --fix",
"serve": "sls offline -P 4000",
"start": "node -e js,ts,jsx,tsx -x npm run serve",
"test": "jest",
"test:watch": "jest --watch",
"build": "sls webpack",
"setup": "./bin/setup",
"graphql-codegen": "graphql-codegen --config codegen.yml"
},
"devDependencies": {
"@graphql-codegen/cli": "^2.6.2",
"@graphql-codegen/typescript": "^2.4.7",
"@types/aws-lambda": "^8.10.93",
"@types/jest": "^25.2.3",
"@types/uuid": "^8.3.4",
"@typescript-eslint/eslint-plugin": "^3.10.1",
"@typescript-eslint/parser": "^3.10.1",
"aws-sdk": "^2.1090.0",
"eslint": "^6.8.0",
"eslint-config-prettier": "^6.15.0",
"husky": "^4.3.8",
"lint-staged": "^10.5.4",
"nodemon": "^2.0.0",
"prettier": "^2.5.1",
"serverless": "^3.7.5",
"serverless-dotenv-plugin": "^3.12.2",
"serverless-offline": "^8.5.0",
"serverless-plugin-warmup": "^7.1.0",
"serverless-prune-plugin": "^2.0.1",
"serverless-webpack": "^5.6.1",
"ts-jest": "^25.5.1",
"ts-loader": "^6.2.2",
"typescript": "^3.6.3",
"webpack": "^4.46.0",
"webpack-node-externals": "^1.7.2"
},
"husky": {
"hooks": {
"pre-commit": "lint-staged"
}
},
"lint-staged": {
"src/**/*.{js,ts}": [
"npm run lint",
"prettier --write",
"git add"
]
},
"dependencies": {
"apollo-server-core": "^3.5.0",
"apollo-server-lambda": "^3.5.0",
"aws-lambda": "^1.0.7",
"graphql": "^15.8.0",
"ramda": "^0.28.0",
"uuid": "^8.3.2"
}
} Originally posted by @alakdam07 in #10858 |
Beta Was this translation helpful? Give feedback.
Answered by
0xk0nf
Nov 13, 2023
Replies: 1 comment 1 reply
-
Hi @melvindraaijer
|
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
0xazuki7
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi @melvindraaijer
I believe this section is problematic in your case
serverless-dotenv-plugin
loads different.env
files based on the stage (e.g. passed via--env
arg) but this tries to accessSTAGE
from environment. Short "fix" might be to declare stage explicitly as an env var when invoking command .e.gSTAGE=uat sls deploy --env uat
in your case.