FluidFramework
FluidFramework copied to clipboard
Build error at AzureClient.createContainer call.
I am trying to use AzureClient.createContainer in my testing example in the newest Fluid sources at main branch, commit 15c922f721519ab72c93a787e54738b8e76ccf74. We discussed this with @vladsud @DLehenbauer so here are details.
I am using following AzureClient
"@fluidframework/azure-client": "^1.0.1"
I believe that it uses following fluid-static dependency
"@fluidframework/fluid-static": "^1.0.1"
The latest version of @fluidframework/fluid-static on my clone looks to be
"version": "1.2.2"
I am getting build error at AzureClient.createContainer and AzureClient.getContainer within the following code obtaining SharedMap container. It also fails for SharedPropertyTree and DeflatedPropertyTree.
const containerSchema = {
initialObjects: { tree: SharedMap }
};
const createNew = containerId === undefined;
const clienTiny = new AzureClient({
connection: {
type: "local",
tokenProvider: new InsecureTokenProvider("", { id: "userId" }),
endpoint: "http://localhost:7070"
},
logger,
});
const client = clienTiny;
let containerAndServices;
if (createNew) {
containerAndServices = await client.createContainer(containerSchema);
containerId = await containerAndServices.container.attach();
} else {
containerAndServices = await client.getContainer(containerId!, containerSchema);
}
The build errors happen at
client.createContainer(containerSchema) and client.getContainer(containerId!, containerSchema)
The build errors are following
Type '{ tree: typeof SharedMap; }' is not assignable to type 'LoadableObjectClassRecord'.
Property 'tree' is incompatible with index signature.
Type 'typeof SharedMap' is not assignable to type 'LoadableObjectClass<any>'
Type 'typeof SharedMap' is not assignable to type 'DataObjectClass<any>'.
Property 'factory' is missing in type 'typeof SharedMap' but required in type '{ readonly factory: IFluidDataStoreFactory; }'.
69 containerAndServices = await client.createContainer(containerSchema);
../../../node_modules/@fluidframework/fluid-static/dist/types.d.ts:29:14
29 readonly factory: IFluidDataStoreFactory;
~~~~~~~
'factory' is declared here.
src/tracking/workspaces.ts:72:72 - error TS2345: Argument of type '{ initialObjects: { tree: typeof SharedMap; }; }' is not assignable to parameter of type 'ContainerSchema'.
72 containerAndServices = await client.getContainer(containerId!, containerSchema);
@milanro, hard to give any advice here, but looking at the error, and diff between the types, it's expected that you will use MapFactory (or SharedMap.getFactory()) instance instead of SharedMap.
@vladsud Thank you for pointing to this. For me it is not showstopper anymore, I was able to use the way via factory. In any case, it looks to be a regression because this code worked prior 1.2.
@milanro, hard to give any advice here, but looking at the error, and diff between the types, it's expected that you will use MapFactory (or SharedMap.getFactory()) instance instead of SharedMap.
Got it! @skylerjokiel, @anthony-murphy, can you please glance where we failed with violation of minor versions not making breaking changes? Thanks!
it's not clear what is happening here. the commit mentioned above is in main, and not a 1.* release branch, so i don't think i would expect what they are trying to do to work
it's not clear what is happening here. the commit mentioned above is in main, and not a 1.* release branch, so i don't think i would expect what they are trying to do to work
@anthony-murphy Thank you for the comment. I am sending the PM to the main branch which I started to develop a few weeks ago. This code I was using for testing and it worked that time. Now it does not build anymore so I wanted to let you know. I do not relay on this code anymore as I have workaround.
This issue has been automatically marked as stale because it has had no activity for 180 days. It will be closed if no further activity occurs within 8 days of this comment. Thank you for your contributions to Fluid Framework!