tweedegolf / storage-abstraction

Provides an abstraction layer for interacting with a storage; the storage can be local or in the cloud.
MIT License
106 stars 18 forks source link

Module not found - @tweedegolf/storage-abstraction/dist/Storage.js:73:27 #47

Closed nkorent closed 9 months ago

nkorent commented 9 months ago

hey guys, I'm using nextjs 14 and I want to upload file to my local storage using this package but I can not move far.

Version I have installed is 1.5.2.

I'm using form actions, I do get the file there and the part with form works well. The part where I do have issue with is when I call the library with new Storage(config).

I'm trying to instantiate it as it's stated in readme:

... import { Storage, StorageType } from "@tweedegolf/storage-abstraction"; ...

  console.log(data.file);
  console.log(data.folderId);

  const s = new Storage({
    type: StorageType.LOCAL,
    directory: "~/code/uploadtest",
    skipCheck: true,
  });

  console.log(s);

  // await documentService.createDocument(data);
  revalidatePath(route("admin.dataset.show", { id: data.folderId }));
  redirect(route("admin.dataset.show", { id: data.folderId }));
});

....

and the error I am getting is always the same:

Screenshot 2023-12-04 at 17 56 40

I have tried installing aws-sdk as well, but that did not help at all too (was a far fetch anyways).

I am not sure how to proceed to even debug this issue in the package so any advice would be welcome.

nkorent commented 9 months ago

I have figured out what the issue is. Basically turbo is interfering with how the package is injected. turning off --turbo on next resolved the issue as it appears.

abudaan commented 9 months ago

Thanks!