Skip to content

Commit

Permalink
Nodejs version changes (#113)
Browse files Browse the repository at this point in the history
* Update develop.yml - node version to 14

* Update prepareAssetUpload.js - log possible errors

* Update develop.yml - allow debug

* Update prepareAssetUpload.js

* Update prepareAssetUpload.js

* Update prepareAssetUpload.js

* Update prepareAssetUpload.js - revert changes

* Update serverless.yml - changed node version

* Update serverless.yml - testing version

* Update package.json - serverless minor update

* Update prepareAssetUpload.js - log

* Update serverless.yml - change to node 14

* Update project-save-hoc.jsx - error logs

* Update project-save-hoc.jsx - bad error msg

* Update prepareAssetUpload.js - logging

* changed nodejs version of deployment (#114)
  • Loading branch information
cami-espinozaq authored Nov 24, 2023
1 parent 9372d48 commit 844f4e6
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 5 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/develop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/production.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion serverless.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down
4 changes: 4 additions & 0 deletions src/backend/prepareAssetUpload.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'.")
}
Expand All @@ -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 })
Expand Down
5 changes: 4 additions & 1 deletion src/lib/project-save-hoc.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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()
Expand Down

0 comments on commit 844f4e6

Please sign in to comment.