Wappler Version : 4.4.0
Operating System : Mac OS Big Sur
Server Model: Node Js
Database Type: My Sql
Hosting Type: Docker
Expected behavior
S3 should still retrieve images
Actual behavior
After update I get this error
{
"status": "500",
"message": "s3.getSignedUrl is not a function",
"stack": "TypeError: s3.getSignedUrl is not a function\n at App.signDownloadUrl (/opt/node_app/lib/modules/s3.js:128:19)\n at App._exec (/opt/node_app/lib/core/app.js:463:57)\n at App._exec (/opt/node_app/lib/core/app.js:434:28)\n at runMicrotasks (<anonymous>)\n at processTicksAndRejections (internal/process/task_queues.js:97:5)\n at async App.exec (/opt/node_app/lib/core/app.js:403:9)\n at async App.define (/opt/node_app/lib/core/app.js:393:9)"
}
How to reproduce
Try a sign download url with s3 (im using digital ocean spaces)
npm WARN @aws-sdk/middleware-sdk-s3@3.41.0 requires a peer of @aws-sdk/signature-v4-crt@^3.31.0 but none is installed. You must install peer dependencies yourself.
When installing the node packages
And when i create a new s3 as it looked like the module was missing as even upload wonât work I see this in the deploy log:
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@~2.3.2 (node_modules/chokidar/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.3.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm WARN @aws-sdk/middleware-sdk-s3@3.41.0 requires a peer of @aws-sdk/signature-v4-crt@^3.31.0 but none is installed. You must install peer dependencies yourself.
wasnât sure If the aws-sdk one is related to help narrow the issue.
The signature-v4-crt package is not needed, it is needed for the S3 Multi-Region Access Point (MRAP) feature which we donât support. It is registered in the package.json from the s3 sdk as a peer dependency, but is actually an optional dependency.
I will check the getSignedUrl function, the sdk was upgraded from v2 to v3, so there could be some incompatibility. Did you also update the files in the lib folder?
I chose to update on every pop up that asks so I believe so canât remember all the pop ups entirely.
It seems that on 4.4.1 the s3.getSignedUrl looks to be working but s3.upload is throwing the error still:
{
"status": "500",
"message": "s3.upload is not a function",
"stack": "TypeError: s3.upload is not a function\n at App.putFile (/opt/node_app/lib/modules/s3.js:70:19)\n at App._exec (/opt/node_app/lib/core/app.js:463:57)\n at App._exec (/opt/node_app/lib/core/app.js:434:28)\n at async App.exec (/opt/node_app/lib/core/app.js:403:9)\n at async App.repeat (/opt/node_app/lib/modules/core.js:72:17)\n at async App._exec (/opt/node_app/lib/core/app.js:463:30)\n at async App._exec (/opt/node_app/lib/core/app.js:434:17)\n at async App.exec (/opt/node_app/lib/core/app.js:403:9)\n at async App.define (/opt/node_app/lib/core/app.js:393:9)"
}
Seems like you have a mixture of old server connect files and new packages.
Try forcing update of all server connect files by deleting The âlibâ folder in your root and then save a server connect action so it will be regenerated.
Make sure it is all well deployed to your live server afterwards.
New error: s3.upload is not a function - just like @Sorry_Duh
{status: "500", message: "s3.upload is not a function",âŚ}
message: "s3.upload is not a function"
stack: "TypeError: s3.upload is not a function\n at App.putFile (/opt/node_app/lib/modules/s3.js:70:19)\n at App._exec (/opt/node_app/lib/core/app.js:463:57)\n at App._exec (/opt/node_app/lib/core/app.js:434:28)\n at async App.exec (/opt/node_app/lib/core/app.js:403:9)\n at async App.exec (/opt/node_app/lib/modules/core.js:197:13)\n at async App._exec (/opt/node_app/lib/core/app.js:463:30)\n at async App._exec (/opt/node_app/lib/core/app.js:434:17)\n at async App.exec (/opt/node_app/lib/core/app.js:403:9)\n at async App.define (/opt/node_app/lib/core/app.js:393:9)"
status: "500"
message: "Bucket name shouldn't contain '/', received 'smartclasses/school/2/course/3/lecture/3'"
stack: "InvalidBucketName: Bucket name shouldn't contain '/', received 'smartclasses/school/2/course/3/lecture/3'\n at /opt/node_app/node_modules/@aws-sdk/middleware-sdk-s3/dist-cjs/validate-bucket-name.js:9:25\n at /opt/node_app/node_modules/@aws-sdk/middleware-logger/dist-cjs/loggerMiddleware.js:6:28\n at S3.send (/opt/node_app/node_modules/@aws-sdk/smithy-client/dist-cjs/client.js:20:20)\n at S3.putObject (/opt/node_app/node_modules/@aws-sdk/client-s3/dist-cjs/S3.js:1229:25)\n at App.putFile (/opt/node_app/lib/modules/s3.js:70:19)\n at App._exec (/opt/node_app/lib/core/app.js:463:57)\n at App._exec (/opt/node_app/lib/core/app.js:434:28)\n at async App.exec (/opt/node_app/lib/core/app.js:403:9)\n at async App.define (/opt/node_app/lib/core/app.js:393:9)"
status: "500"
Perhaps the update changed something? How can I upload a file to certain folder in digital ocean spaces?
We usually keep the bucket name to just say smartclass, and rest of the path goes into the key.
Make sure to NOT start the key with a /.
It could be that the way you were doing it earlier should not have been allowed.
Thanks @sid, literally just closed this issue and parked it for later when I got your reply.
Let me try that, I thought they âkeyâ part was just for finding the file on the server - not for the space!
A similar problem occurred after the update. And I changed the existing s3.js file to the s3.js file attached by Patrick. After changing the file, it is uploaded well to s3 through âputfileâ, but not through âsign upload urlâ.
When attempting to upload through âsign upload urlâ, 403 error occurs.