-
Notifications
You must be signed in to change notification settings - Fork 102
Feature: custom runtimes to define function #1602
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 4 commits
49abcbd
dbdccba
26ea2f2
9f6f2e4
cefa084
53b475f
89b52d4
497da33
70db088
cbaa8bc
7a79923
10726dd
d7cf435
aa6762e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@aws-amplify/backend-function': minor | ||
--- | ||
|
||
add custom provided function support to define function |
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Following up on my overall comment, I'm not sure how we're going to handle environment variables of type There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @MarlonJD @arash2060 I am so excited to see this functionality so close! I am new to Amplify and have been enjoying the ease of development...but got hung up royally today trying to figure out how to add a custom query to my graphql schema via a lambda with python 3_11 runtime. This functionality will be well-used and loved as I build out slew of microservices that use LangChain. I am wondering if you would consider deploying without supporting environment variables for now as a way to get this into our hands. From my understanding, that would require adding a permission for the lambda to access the secret store with boto3 and a warning about the additional cost and latency while the full functionality is being built out. Is this feasible? Curious to hear your thoughts. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Hey there! If you want to auto deploy with amplify we should use AWS Secret Manager, it's because |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
import { Construct } from 'constructs'; | ||
import { | ||
BackendOutputStorageStrategy, | ||
FunctionResources, | ||
ResourceAccessAcceptor, | ||
ResourceAccessAcceptorFactory, | ||
ResourceProvider, | ||
} from '@aws-amplify/plugin-types'; | ||
import { Stack } from 'aws-cdk-lib'; | ||
import { | ||
FunctionOutput, | ||
functionOutputKey, | ||
} from '@aws-amplify/backend-output-schemas'; | ||
import { AttributionMetadataStorage } from '@aws-amplify/backend-output-storage'; | ||
import { fileURLToPath } from 'node:url'; | ||
|
||
const functionStackType = 'function-Lambda'; | ||
|
||
/** | ||
* A base class for function constructs. | ||
*/ | ||
export abstract class AmplifyFunctionBase | ||
extends Construct | ||
implements ResourceProvider<FunctionResources>, ResourceAccessAcceptorFactory | ||
{ | ||
readonly stack: Stack; | ||
abstract resources: FunctionResources; | ||
|
||
abstract getResourceAccessAcceptor: () => ResourceAccessAcceptor; | ||
|
||
/** | ||
* Creates base function construct. | ||
*/ | ||
protected constructor( | ||
scope: Construct, | ||
id: string, | ||
private readonly outputStorageStrategy: BackendOutputStorageStrategy<FunctionOutput> | ||
) { | ||
super(scope, id); | ||
|
||
this.stack = Stack.of(scope); | ||
|
||
new AttributionMetadataStorage().storeAttributionMetadata( | ||
Stack.of(this), | ||
functionStackType, | ||
fileURLToPath(new URL('../package.json', import.meta.url)) | ||
); | ||
} | ||
|
||
protected storeOutput = (): void => { | ||
this.outputStorageStrategy.appendToBackendOutputList(functionOutputKey, { | ||
version: '1', | ||
payload: { | ||
definedFunctions: this.resources.lambda.functionName, | ||
}, | ||
}); | ||
}; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,3 @@ | ||
export * from './factory.js'; | ||
import { ProvidedFunctionProps } from './provided_function_factory.js'; | ||
export { ProvidedFunctionProps }; |
Uh oh!
There was an error while loading. Please reload this page.