Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unknown encoding: base64url with version 0.6.0 #247

Closed
tomgreco opened this issue May 27, 2022 · 6 comments
Closed

Unknown encoding: base64url with version 0.6.0 #247

tomgreco opened this issue May 27, 2022 · 6 comments

Comments

@tomgreco
Copy link

tomgreco commented May 27, 2022

Using tus-js-client on client side.
On the latest version I started getting this error on every patch request.

backend_1       | 2022-05-27T01:32:25.110Z tus-node-server:stores:s3store [621fc6ab24f75100564f1c19/628b88ca3d32db002ab6bfe4/H/image/c04d6e51-11be-4614-846f-f3ee44e7ab3f.621fc6ab24f75100564f1c19_1653702287033_main] retrieving metadata
backend_1       | 2022-05-27T01:32:25.110Z tus-node-server:stores:s3store [621fc6ab24f75100564f1c19/628b88ca3d32db002ab6bfe4/H/image/c04d6e51-11be-4614-846f-f3ee44e7ab3f.621fc6ab24f75100564f1c19_1653702287033_main] metadata from cache
backend_1       | 2022-05-27T01:32:25.364Z tus-node-server:stores:s3store [621fc6ab24f75100564f1c19/628b88ca3d32db002ab6bfe4/H/image/c04d6e51-11be-4614-846f-f3ee44e7ab3f.621fc6ab24f75100564f1c19_1653702287033_main] retrieving metadata
backend_1       | 2022-05-27T01:32:25.364Z tus-node-server:stores:s3store [621fc6ab24f75100564f1c19/628b88ca3d32db002ab6bfe4/H/image/c04d6e51-11be-4614-846f-f3ee44e7ab3f.621fc6ab24f75100564f1c19_1653702287033_main] metadata from cache
backend_1       | 2022-05-27T01:32:25.515Z tus-node-server:handlers:patch [PatchHandler] TypeError [ERR_UNKNOWN_ENCODING] [ERR_UNKNOWN_ENCODING]: Unknown encoding: base64url
backend_1       |     at Buffer.toString (buffer.js:803:11)
backend_1       |     at randomString (project/node_modules/tus-node-server/lib/models/StreamSplitter.js:7:37)
@tomgreco tomgreco changed the title Error Handling ? Unknown encoding: base64url with versino 0.6.0 May 27, 2022
@tomgreco tomgreco changed the title Unknown encoding: base64url with versino 0.6.0 Unknown encoding: base64url with version 0.6.0 May 27, 2022
@tomgreco
Copy link
Author

Looks like base64url is not part of the version of node I am running.
The work around for this was to patch StreamSplitter.js

const base64url = require('base64url');

function randomString(size) {
    return base64url.toBase64(crypto.randomBytes(size)).slice(0, size);
}

@Murderlon
Copy link
Member

Thanks for reporting. @tomgreco which version of Node are you running?

@Murderlon
Copy link
Member

That's an npm package, but I'm curious about the node version which got the mentioned error. If it's an old (unsupported) Node version, this doesn't need a fix.

@tomgreco
Copy link
Author

@Murderlon node v14.15.4

@Murderlon
Copy link
Member

base64url was a Node 15 feature (nodejs/node#36952) but it was backported to Node 14. However, your version is a bit too old. It was backported to 14.18.0. Consider upgrading to that or ideally to latest LTS (16.15.0 at the time of writing).

I'm working towards tus-node-server@1.0.0 for which there will be official supported Node versions (`>14.18.0).

@Murderlon Murderlon closed this as not planned Won't fix, can't repro, duplicate, stale May 31, 2022
@tomgreco
Copy link
Author

tomgreco commented Jun 1, 2022

@Murderlon fair enough. Looking forward to more updates :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants