Skip to content

Commit

Permalink
fix: deploy sls but not apply it ot lambda when first create
Browse files Browse the repository at this point in the history
Signed-off-by: seven <[email protected]>
  • Loading branch information
Blankll committed Jan 12, 2025
1 parent 1bddf92 commit 218dae4
Show file tree
Hide file tree
Showing 4 changed files with 76 additions and 35 deletions.
19 changes: 12 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@geek-fun/serverlessinsight",
"version": "0.2.0",
"version": "0.2.1",
"description": "Full life cycle cross providers serverless application management for your fast-growing business.",
"homepage": "https://serverlessinsight.geekfun.club",
"main": "dist/src/index.js",
Expand Down
54 changes: 27 additions & 27 deletions src/stack/rosStack/function.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,35 +26,35 @@ export const resolveFunctions = (
let logConfig: RosFunction.LogConfigProperty | undefined = undefined;

const enableLog = functions?.some(({ log }) => log);
if (enableLog) {
const slsService = new sls.Project(
scope,
`${service}_sls`,
{ name: `${service}-sls`, tags: replaceReference(tags, context) },
true,
);
const slsService = new sls.Project(
scope,
`${service}_sls`,
{ name: `${service}-sls`, tags: replaceReference(tags, context) },
true,
);

const slsLogstore = new sls.Logstore(
scope,
`${service}_sls_logstore`,
{
logstoreName: `${service}-sls-logstore`,
projectName: slsService.attrName,
ttl: 7,
},
true,
);
const slsLogstore = new sls.Logstore(
scope,
`${service}_sls_logstore`,
{
logstoreName: `${service}-sls-logstore`,
projectName: slsService.attrName,
ttl: 7,
},
true,
);

new sls.Index(
scope,
`${service}_sls_index`,
{
projectName: slsService.attrName,
logstoreName: slsLogstore.attrLogstoreName,
fullTextIndex: { enable: true },
},
true,
);
new sls.Index(
scope,
`${service}_sls_index`,
{
projectName: slsService.attrName,
logstoreName: slsLogstore.attrLogstoreName,
fullTextIndex: { enable: true },
},
true,
);
if (enableLog) {
logConfig = {
project: slsLogstore.attrProjectName,
logstore: slsLogstore.attrLogstoreName,
Expand Down
36 changes: 36 additions & 0 deletions tests/fixtures/deployFixture.ts
Original file line number Diff line number Diff line change
Expand Up @@ -473,6 +473,42 @@ export const minimumRos = {
Metadata: { 'ALIYUN::ROS::Interface': { TemplateTags: ['Create by ROS CDK'] } },
ROSTemplateFormatVersion: '2015-09-01',
Resources: {
'my-demo-minimum-service_sls': {
Properties: {
Name: 'my-demo-minimum-service-sls',
},
Type: 'ALIYUN::SLS::Project',
},
'my-demo-minimum-service_sls_index': {
Properties: {
FullTextIndex: {
Enable: true,
},
LogReduce: false,
LogstoreName: {
'Fn::GetAtt': ['my-demo-minimum-service_sls_logstore', 'LogstoreName'],
},
ProjectName: {
'Fn::GetAtt': ['my-demo-minimum-service_sls', 'Name'],
},
},
Type: 'ALIYUN::SLS::Index',
},
'my-demo-minimum-service_sls_logstore': {
Properties: {
AppendMeta: false,
AutoSplit: false,
EnableTracking: false,
LogstoreName: 'my-demo-minimum-service-sls-logstore',
PreserveStorage: false,
ProjectName: {
'Fn::GetAtt': ['my-demo-minimum-service_sls', 'Name'],
},
ShardCount: 2,
TTL: 7,
},
Type: 'ALIYUN::SLS::Logstore',
},
hello_fn: {
Properties: {
Code: {
Expand Down

0 comments on commit 218dae4

Please sign in to comment.