-
Notifications
You must be signed in to change notification settings - Fork 19
Support changing dataType for a binding in v4 #72
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
Comments
Is there any news on this issue? Or a way to help fix it? |
No updates, but this is still planned to be fixed before we GA. For a workaround, either use the v3 model or use generics: import { app, InvocationContext, trigger } from "@azure/functions";
export async function storageQueueTrigger1(queueItem: unknown, context: InvocationContext): Promise<void> {
context.log(`Is it a buffer? ${Buffer.isBuffer(queueItem)}`);
}
app.generic('storageQueueTrigger1', {
trigger: trigger.generic({
type: 'queueTrigger',
queueName: 'testqueue',
connection: 'storage_APPSETTING',
dataType: 'binary'
}),
handler: storageQueueTrigger1
}); |
Bumping into this, I have a storage extra input trying to load a PDF file, and I cannot get the blob content as a binary. @ejizba is there a workaround when using the v4 |
This has been de-prioritized in favor of a feature that uses In the meantime, the only workaround for extra inputs is to use the sdk and create the blob client yourself. There is no workaround for trigger inputs. Actually, I already mentioned a workaround above using generics, that should still work for both. |
Thanks for the details! I ended up using |
As its still not fixed yet you can use this workaround :
add the |
v3 function.json content:
v3 index.js content:
In v3 the type of
myQueueItem
changes based on the value ofdataType
. If you setdataType
tobinary
,myQueueItem
will be aBuffer
. Otherwise,myQueueItem
will either be astring
or possibly a parsed object if the string was JSON.In v4, we don't allow users to change
myQueueItem
to aBuffer
type, which we should. This does not apply to http triggers, but probably applies to several other triggers/bindings other than storage queue.The text was updated successfully, but these errors were encountered: