Jett Robin Andres
10/30/2021, 12:14 AMSid
attribute specified here so I can view my uploaded image urls via browser. I’ve also tried PublicReadGetObject
in my sst setup as I thought there was just a typo upon reading the official docs from aws. However I’m still getting AccessDenied
error for my uploaded images.
here’s a snippet from my sst auth stack
this.auth.attachPermissionsForAuthUsers([
api,
new iam.PolicyStatement({
sid: 'PublicReadGetObject',
actions: ['s3:*'],
effect: iam.Effect.ALLOW,
resources: [
bucket.bucketArn + '/private/${<http://cognito-identity.amazonaws.com:sub|cognito-identity.amazonaws.com:sub>}/*',
bucket.bucketArn + '/public/*',
bucket.bucketArn +
'/protected/${<http://cognito-identity.amazonaws.com:sub|cognito-identity.amazonaws.com:sub>}/*',
],
}),
])
Here’s my client s3 upload syntax using aws-amplify. Note that I want to remove acl
from my client code. It works on a per-file basis if I uncomment it but I want to rely from sst’s sid instead
const res = await Storage.put(`${receiptId}.jpg`, blob, {
contentType: 'image/jpeg',
level: 'public',
//acl: 'public-read', //TODO: move acl to sst via sid prop
})
Ömer Toraman
10/30/2021, 2:19 PMevent
, and EventBridge
.
import { EventBridgeClient, PutEventsCommand, PutEventsCommandInput } from '@aws-sdk/client-eventbridge'
import { StatusCodes } from 'http-status-codes'
import type { APIGatewayProxyHandler } from "aws-lambda"
const eventBridgeClient = new EventBridgeClient({ region: 'eu-central-1' })
export const handler: APIGatewayProxyHandler = async (evt, ctx, cb) => {
const requestBody = JSON.parse(evt.body)
const { orderID, price } = requestBody
//////////
// Check if the body has required properties
//////////
if (!orderID || !price) {
return {
statusCode: StatusCodes.BAD_REQUEST,
body: 'Invalid request'
}
}
//////////
// Put it into EventBridge
//////////
try {
const putEventsCommandInput: PutEventsCommandInput = {
Entries: [
{ EventBusName: 'OrderBus', Detail: JSON.stringify({ id: orderID, price }) }
]
}
const putEventsCommand = new PutEventsCommand(putEventsCommandInput)
const putEventsCommandOutput = await eventBridgeClient.send(putEventsCommand)
return {
statusCode: StatusCodes.CREATED,
body: JSON.stringify({ eventID: putEventsCommandOutput.Entries[0].EventId })
}
} catch (error) {
return {
statusCode: StatusCodes.ACCEPTED,
body: JSON.stringify(error)
}
}
}
Tharshan
10/30/2021, 5:15 PMAugust C
10/31/2021, 8:33 PM/sst
yarn.lock
package.json
[...]
/shared
yarn.lock
package.json
[...]
/backend
yarn.lock
package.json
[...]
yarn.lock
package.json
Gerald
11/01/2021, 2:07 AMNoah D
11/01/2021, 7:06 AMSyntaxError: Unexpected token 'export'
which leads me to believe my code is being interpreted as typescript instead of javascript when it is uploaded to AWS. I am largely following the setup described in this repo but attempting to have separate workspaces for each service/core lib. I might just be overcomplicating this and should be resorting back to just having the whole backend folder as a workspace, but if I can get it working that would be cool. My current tsconfig for the services is in screenshot #1. And my base tsconfig file is in screenshot #2. Any thoughts/resources on this would be helpful. Been trawling through the ts handbook, but no luck so far 😅Sahan Amadoruge
11/01/2021, 2:27 PMconst bucket = new Bucket(this, "Bucket", {
notifications: [
{
function: "src/notification1.main",
notificationProps: {
events: [EventType.OBJECT_CREATED],
},
},
{
function: "src/notification2.main",
notificationProps: {
events: [EventType.OBJECT_CREATED],
},
},
],
});
Or what is the best way to call different functions on same event?Louis Barclay
11/01/2021, 5:54 PMThe system cannot find the path specified.
), perhaps because node_modules is not recognized as a directory due to being in .gitignore. Possible I am making a basic mistake.
My use case is:
• Want to deploy a NextjsSite from a separate repository, which I have installed into node_modules
• That'll let me be able to develop the separate repository cleanly - I'll update it when I need to - instead of having to have the whole source code for my Next.js app inside the sst
project
import * as sst from "@serverless-stack/resources";
export default class MyStack extends sst.Stack {
constructor(scope, id, props) {
super(scope, id, props);
// Create a Next.js site
const site = new sst.NextjsSite(this, "cloakist-notion-nextjs", {
path: "node_modules/cloakist-notion-nextjs",
environment: {
// Pass the table details to our app
REGION: scope.region,
},
});
// Show the site URL in the output
this.addOutputs({
URL: site.url,
});
}
}
Erik Robertson
11/01/2021, 6:52 PMAdrian Schweizer
11/01/2021, 9:03 PMapp.setDefaultFunctionProps({
environment: {
APP_DOMAIN: process.env.APP_DOMAIN,
EMAIL_FROM: process.env.EMAIL_FROM,
},
});
Tharshan
11/01/2021, 9:24 PMheyysaiii
11/02/2021, 3:41 AMGerald
11/02/2021, 12:41 PMconst serverless = require('serverless-http');
const express = require('express')
const app = express()
app.get('/', function (req, res) {
res.send('Hello World!')
})
module.exports.handler = serverless(app);
Colin Cheung
11/02/2021, 3:25 PMnode_modules/@mikro-orm/core/utils/Configuration.js:230:61: error: Could not resolve "@mikro-orm/mongodb" (mark it as external to exclude it from the bundle)
230 │ ...Name: 'MongoDriver', module: () => require('@mikro-orm/mongodb') },
╵ ~~~~~~~~~~~~~~~~~~~~
> node_modules/@mikro-orm/core/utils/Configuration.js:232:65: error: Could not resolve "@mikro-orm/mariadb" (mark it as external to exclude it from the bundle)
232 │ ...me: 'MariaDbDriver', module: () => require('@mikro-orm/mariadb') },
I'm using mysql driver and its the only driver that doesn't error since I've installed it, wondering why this is happening and if I need to maybe use a custom esbuild config?samer ewidat
11/02/2021, 4:00 PMnpx sst start
the following problem occurs.
Look like you're running sst for the first time in this directory. Please enter a stage name you'd like to use locally. Or hit enter to use the one based on your AWS credentials (samer):
Using stage: samer
Preparing your SST app
Transpiling source
Linting source
=======================
Deploying debug stack
=======================
Deploying stacks
❌ samer-notes-debug-stack failed: The samer-notes-debug-stack stack failed to deploy.
Stack samer-notes-debug-stack
Status: failed
Error: The samer-notes-debug-stack stack failed to deploy.
Cannot convert undefined or null to object
any thoughts?!Adrian Schweizer
11/03/2021, 1:15 AMSahan Amadoruge
11/03/2021, 10:59 AMconst topic = new sst.Topic(this, "imagePut", {
subscribers: [
{
function: {
handler: "src/s3/resize-image.main",
},
},
{
function: {
handler: "src/s3/analize-image.main",
},
},
],
});
const bucket = new sst.Bucket(this, "Bucket", {
s3Bucket: {
bucketName: `${scope.stage}-absc-files`,
},
notifications: [
{
topic: topic,
notificationProps: {
events: [s3.EventType.OBJECT_CREATED],
filters: [{ prefix: "original-images/" }],
},
},
],
});
joe
11/03/2021, 12:02 PMJohn Nguyen
11/03/2021, 1:05 PMAPI
- construct?
Or how would you do that?
I have a FastAPI- app and would like to put it in a Lambda. An ECS with a loadbalancer having API gateway is a bit too much for me...Erik Robertson
11/03/2021, 3:03 PMerror Require statement not part of import statement @typescript-eslint/no-var-requires
I tried adding this at the top of the file :
/* eslint-disable no-eval */
but no difference.
Any other idea ?Matt LeRay
11/03/2021, 3:43 PMColin Cheung
11/03/2021, 3:50 PM// Import VPC
const existingVpc = ec2.Vpc.fromLookup(this, "VPC", {
vpcId: "vpc-XYZ",
});
// Sample function to connect function to VPC
function: {
handler: "src/claim/index.handler",
permissions: claimPermissions,
vpc: existingVpc,
allowPublicSubnet: true,
},
I can see that the VPC is correctly attached in AWS console on the lambda page, but running lambda causes it to timeoutTharshan
11/03/2021, 4:09 PMjustindra
11/03/2021, 4:34 PMSahan Amadoruge
11/03/2021, 5:37 PMDan Van Brunt
11/03/2021, 6:59 PMMike McCall
11/03/2021, 8:08 PM@next/swc-darwin-arm64 not accessible from next
Next is not installed in the project, this is an sst dependency. I am running into this issue in code build running npm ci
Dan Van Brunt
11/03/2021, 8:58 PMPatrick Gold
11/03/2021, 9:26 PMSteven Cao
11/03/2021, 9:30 PM