fix lambda CORS

Signed-off-by: Andrey Platov <andrey@hardcoreeng.com>
This commit is contained in:
Andrey Platov 2021-08-08 17:10:36 +02:00
parent ce348f1a92
commit 67940e0d35
No known key found for this signature in database
GPG Key ID: C8787EFEB4B64AF0
4 changed files with 12 additions and 7 deletions

View File

@ -106,11 +106,11 @@ const api = new awsx.apigateway.API("login", {
const result = handle(body, serverEndpoint.get()) const result = handle(body, serverEndpoint.get())
return { return {
statusCode: result.statusCode, statusCode: result.statusCode,
// headers: { headers: {
// "Access-Control-Allow-Headers" : "Content-Type", "Access-Control-Allow-Headers" : "Content-Type",
// "Access-Control-Allow-Origin": "*", "Access-Control-Allow-Origin": "*",
// "Access-Control-Allow-Methods": "GET,HEAD,POST" "Access-Control-Allow-Methods": "OPTIONS,POST"
// }, },
body: result.body body: result.body
} }
}, },

3
dev/prod/.env-prod Normal file
View File

@ -0,0 +1,3 @@
APP_ACCOUNTS_URL=https://ftwm71rwag.execute-api.us-west-2.amazonaws.com/stage/

View File

@ -36,8 +36,10 @@ import { setMetadata } from '@anticrm/platform'
export function configurePlatform() { export function configurePlatform() {
console.log(process.env.APP_ACCOUNTS_URL)
// setMetadata(login.metadata.AccountsUrl, 'https://ftwm71rwag.execute-api.us-west-2.amazonaws.com/stage/') // setMetadata(login.metadata.AccountsUrl, 'https://ftwm71rwag.execute-api.us-west-2.amazonaws.com/stage/')
setMetadata(login.metadata.AccountsUrl, '/api') setMetadata(login.metadata.AccountsUrl, process.env.APP_ACCOUNTS_URL)
// if (process.env.CLIENT === 'dev') // if (process.env.CLIENT === 'dev')
addLocation(clientId, () => import(/* webpackChunkName: "client-dev" */ '@anticrm/dev-client-resources')) addLocation(clientId, () => import(/* webpackChunkName: "client-dev" */ '@anticrm/dev-client-resources'))

View File

@ -152,7 +152,7 @@ module.exports = {
new MiniCssExtractPlugin({ new MiniCssExtractPlugin({
filename: '[name].css' filename: '[name].css'
}), }),
new Dotenv() new Dotenv({path: prod ? '.env-prod' : '.env'})
], ],
devtool: prod ? false : 'source-map', devtool: prod ? false : 'source-map',
devServer: { devServer: {