Comments (8)
Can you tell me more about this?
not working for imported lambda from another file
from ion.
Hi @jayair Please find. Am i doing something wrong!
![Screenshot 2024-07-22 at 12 01 09 AM](https://private-user-images.githubusercontent.com/46839821/350789437-87ada61a-4098-40c5-a753-13f3e870486c.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjMzOTcwMTgsIm5iZiI6MTcyMzM5NjcxOCwicGF0aCI6Ii80NjgzOTgyMS8zNTA3ODk0MzctODdhZGE2MWEtNDA5OC00MGM1LWE3NTMtMTNmM2U4NzA0ODZjLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MTElMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODExVDE3MTgzOFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWZkNWVlOTdiYzQyYmVlZWZhODhlYWRjZGQxOWYwZmY4OWY1YTY1OTVmNzM5ODBhNTdiODFmMWI4MGM3ZmNjNjImWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.SN2JUC7O4imUHCMnuSYqDYjsI1pxb9PqvDMEs7CQ884)
import { config } from 'dotenv'
const _stage = $app.stage
const parsedENV = config({ path: `./lambda/.env.${_stage}` }).parsed
export const lambda = new sst.aws.Function('CognitoHandler', {
handler: './lambda/index.handler',
environment: {
...parsedENV,
MAX_ATTEMPTS: 3
},
description: 'cognito-handlers',
runtime: 'nodejs20.x',
timeout: '10 seconds',
memory: '1024 MB',
permissions: [
{
actions: ['ses:SendEmail', 'ses:SendRawEmail'],
resources: ['*']
},
{
actions: ['sns:Publish', 'sns:Subscribe'],
resources: ['*']
}
],
logging: {
retention: '3 year' // for audit purpose
},
transform: {
function: {
name: `${_stage}-sso-cognito-handler`
}
}
})
from ion.
@imdkbj When you pass in function ARNs via transform
, you are responsible for creating the function and assigning the required permissions. So you'd have to create the aws.lambda.Permission
resources as shown in ur code block above.
Btw, why r the functions created separately? Can't you create them inline?
from ion.
Hey @fwang Thanks for the inputs.
- Agree with the transform point.
- I am creating seprate lamda as only one lambda is being assigned to all event. Lambda is being created in same sst deploy session not isolated anyhow.
- Can you check why last photo why that is giving promise error. That can solver the underlying permission issue.
If required, I can share the all codes here.
from ion.
@imdkbj triggers
expects path to the function handler, not ARN of existing functions.
Give this a try:
new sst.aws.CognitoUserPool("MyUserPool", {
transform: {
userPool: {
lambdaConfig: {
createAuthChallenge: lambda.arn,
defineAuthChallenge: lambda.arn,
...
}
}
}
});
Feel free to reopen this if issue persist.
from ion.
Hi @fwang Thanks.
As you can see in my screenshot, I am using the exactly same. But how we can make use without transformer where a single lambda will be used for multiple triggers as if we use path then multiple lambda will be created.
from ion.
I'm confused, are you saying you don't want to use the transform
?
from ion.
Hey, Yes! I can skip transform if we can get the option to pass path/arn to the function handler.
from ion.
Related Issues (20)
- Go error when running dev mode HOT 3
- Simple application isn't deploying when running npx sst dev HOT 3
- ApiGateway Private integration routes HOT 1
- v0.1.83 sst shell not injecting resources HOT 1
- SST 0.1.81+, local dev, all APIs returning 500 responses, bridge.go error HOT 7
- `sst install --stage {stage}` not generating stage file (sst 0.1.87) HOT 2
- Cannot Specify Custom Name for AppSync API HOT 1
- Type '"type"' cannot be used to index type 'Resource[key]'.
- .env file not being picked up HOT 3
- Unable to click links shown in CLI output in VSCode integrated terminal
- `sst dev` lambdas fail quite often HOT 1
- Create Lifecycle Build Scripts to Enable Pothos Type Generation and Other Things HOT 3
- The symbol "aws" has already been declared HOT 2
- Feature: Allow direct use of sst.aws.Cdn HOT 3
- Nodejs lambda handler for live lambdas does not work for files where the name has a dot
- Lambda runtime error in dev mode HOT 2
- Bug: `Expired Token` encountered when trying to `PUT` on lambda-generated S3 Presigned URL HOT 2
- ability to copy output from console in dev mode HOT 2
- ECONNREFUSED in refresh and deploy commands HOT 1
- Using a custom domain with Nextjs
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ion.