Skip to content

Commit 03881b2

Browse files
committed
chore: wip
1 parent 3f0b7c3 commit 03881b2

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

.stacks/core/cloud/src/cloud.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import {
2020
import { hasFiles } from '@stacksjs/storage'
2121
import { path as p } from '@stacksjs/path'
2222
import { app, cloud } from '@stacksjs/config'
23+
import { env } from '@stacksjs/env'
2324

2425
export class StacksCloud extends Stack {
2526
domain: string
@@ -109,13 +110,14 @@ export class StacksCloud extends Stack {
109110
description: 'Bun is an incredibly fast JavaScript runtime, bundler, transpiler, and package manager.',
110111
})
111112

113+
let environment = { ...env }
114+
let keysToRemove = ['_HANDLER', '_X_AMZN_TRACE_ID', 'AWS_REGION', 'AWS_EXECUTION_ENV', 'AWS_LAMBDA_FUNCTION_NAME', 'AWS_LAMBDA_FUNCTION_MEMORY_SIZE', 'AWS_LAMBDA_FUNCTION_VERSION', 'AWS_LAMBDA_INITIALIZATION_TYPE', 'AWS_LAMBDA_LOG_GROUP_NAME', 'AWS_LAMBDA_LOG_STREAM_NAME', 'AWS_ACCESS_KEY', 'AWS_ACCESS_KEY_ID', 'AWS_SECRET_ACCESS_KEY', 'AWS_SESSION_TOKEN', 'AWS_LAMBDA_RUNTIME_API', 'LAMBDA_TASK_ROOT', 'LAMBDA_RUNTIME_DIR']
115+
keysToRemove.forEach(key => delete environment[key])
116+
112117
const stacksServerFunction = new lambda.Function(this, 'StacksServer', {
113118
description: 'The Stacks Server',
114119
tracing: lambda.Tracing.ACTIVE,
115-
environment: {
116-
// TODO: update this to use the correct env
117-
TEST_ENV: 'test',
118-
},
120+
environment,
119121
code: lambda.Code.fromAsset(p.projectStoragePath('framework/cloud/lambda.zip')),
120122
handler: 'server.fetch',
121123
runtime: lambda.Runtime.PROVIDED_AL2,

.stacks/core/env/src/index.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -124,17 +124,17 @@ export type FrontendEnvKeys = keyof FrontendEnv
124124
const cache: { [key: string]: any } = {}
125125

126126
const handler = {
127-
get(target: NodeJS.ProcessEnv, prop: string) {
127+
get(target: any, prop: string) {
128128
if (prop in cache)
129129
return cache[prop]
130130

131-
const newEnv = loadEnv('development', projectPath(), '') as (NodeJS.ProcessEnv & Env)
131+
// TODO: make mode dynamic
132+
const newEnv = loadEnv('development', projectPath(), '')
132133
cache[prop] = newEnv[prop]
133134
return newEnv[prop]
134135
},
135136

136137
set(target: NodeJS.ProcessEnv, prop: string, value: string) {
137-
// const newEnv = loadEnv('development', projectPath(), '')
138138
if (prop in target) {
139139
process.env[prop] = value
140140
cache[prop] = value

0 commit comments

Comments
 (0)