diff --git a/.github/workflows/develop.yml b/.github/workflows/develop.yml index b80ae44fa..e8fe1a88e 100644 --- a/.github/workflows/develop.yml +++ b/.github/workflows/develop.yml @@ -10,13 +10,14 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - node-version: [12.x] + node-version: [14.x] python-version: [3.0] env: S3_BUCKET_PREFIX: hackingstudio-code4maus-projects AWS_REGION: eu-central-1 AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + SLS_DEBUG: true steps: - name: Checkout app uses: actions/checkout@v3 diff --git a/.github/workflows/production.yml b/.github/workflows/production.yml index eb731ba7f..fc94b9546 100644 --- a/.github/workflows/production.yml +++ b/.github/workflows/production.yml @@ -9,7 +9,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - node-version: [12.x] + node-version: [14.x] python-version: [3.0] env: BRANCH: production diff --git a/package.json b/package.json index b0098a109..cfe0ef995 100644 --- a/package.json +++ b/package.json @@ -133,7 +133,7 @@ "scratch-storage": "1.2.2", "scratch-svg-renderer": "0.2.0-prerelease.20210511195415", "selenium-webdriver": "4.0.0-alpha.1", - "serverless": "^1.30.3", + "serverless": "^1.83.3", "serverless-domain-manager": "^3.1.0", "serverless-dotenv-plugin": "^2.0.1", "serverless-offline": "^4.9.2", diff --git a/serverless.yml b/serverless.yml index 19ffceaee..f7047d85e 100644 --- a/serverless.yml +++ b/serverless.yml @@ -2,7 +2,7 @@ service: hackingstudio-code4maus provider: name: aws - runtime: nodejs18.x + runtime: nodejs14.x region: eu-central-1 role: 'arn:aws:iam::#{AWS::AccountId}:role/hackingstudio/code4maus/hackingstudio-code4maus-functions' stage: ${file(scripts/env.js):stage} diff --git a/src/backend/prepareAssetUpload.js b/src/backend/prepareAssetUpload.js index 8de0f7dd1..9efd1364e 100644 --- a/src/backend/prepareAssetUpload.js +++ b/src/backend/prepareAssetUpload.js @@ -10,6 +10,8 @@ const s3 = initS3(customEndpoint) export const handler = async (event) => { const { filename } = JSON.parse(event.body) + console.log("filename for handler", filename) + if (!filename) { return respond.error(400, "Missing request body key 'filename'.") } @@ -19,6 +21,8 @@ export const handler = async (event) => { Key: `data/assets/${filename}`, } + console.log("params", params) + try { await s3.headObject(params).promise() return respond.error(409, 'Asset already exists.', { exists: true }) diff --git a/src/lib/project-save-hoc.jsx b/src/lib/project-save-hoc.jsx index dfddb5b5c..03ec9cf23 100644 --- a/src/lib/project-save-hoc.jsx +++ b/src/lib/project-save-hoc.jsx @@ -76,6 +76,7 @@ const ProjectSaveHOC = (WrappedComponent) => { await this.saveMeta() } catch (e) { if (!this.requestCancelSave) { + console.warn("error in saving:", e) errPromise = this.setError('Das hat leider nicht geklappt') } else { errPromise = Promise.reject() @@ -107,8 +108,10 @@ const ProjectSaveHOC = (WrappedComponent) => { filename: asset.fileName, }), }) + if (!res.ok && res.status !== 409) { - throw new Error(`uploading an asset failed: ${asset.filename}`) + console.warn("save assets error response", res) + throw new Error(`uploading an asset failed: ${asset.fileName}`) } const body = await res.json()