-
Notifications
You must be signed in to change notification settings - Fork 28
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
Unhandled type: Bytes #16
Comments
I get the same. Any idea how it should behave in the case of Bytes? |
Faced with the same problem, but was able to find the temporary solution: First of all, I i've got such (dot notation) Payload: {
.....
'password.type': 'Buffer',
'password.data.0': '123',
'password.data.1': '21',
'password.data.2': '146',
'password.data.3': '168',
'password.data.4': '174',
.....
} Into a normal object: ....
{
type: 'Buffer',
data: [
'123', '21', '146', '168', '174',
'142', '68', '50', '105', '91',
'154', '143', '96', '108', '201',
'236', '4', '73', '76', '161',
'109', '120', '172', '212', '161',
'172', '152', '115', '2', '146',
'122', '53'
]
}
.... After that, we take Data from this object and turn it into a Buffer Buffer.from(payload.password.data) And after that I reassign this Buffer to the password value in the payload. Full code: options: {
actions: {
edit: {
before: async (request) => {
if (isGETMethod(request)) {
return request;
}
// convert "dot notation" to regular object
let payload: any = {};
for (const key in request.payload) {
_.set(payload, key, _.get(request.payload, key));
}
// convert "password object" to Buffer & assign to payload
_.set(payload, 'password', Buffer.from(payload.password.data));
request.payload = payload;
// return request.payload.password with Buffer type
return request
},
}
}
} It's my first day using AdminJS and I don't know all the mechanics - if someone can write some more convenient handler for Bytes data based on this, it will be cool. |
It seems that the prisma adapter does not support the "bytes" type:
https://www.prisma.io/docs/reference/api-reference/prisma-schema-reference#bytes
Console output simply says:
Unhandled type: Bytes
The text was updated successfully, but these errors were encountered: