Skip to content
Back

Using a local package inside of a cloud function

  • 0
  • Functions
  • Cloud
guyluz11
14 Aug, 2025, 00:10

Hey all

I am trying to understand if what I want is possible or I am looking at it wrong. I am trying to use the a local package inside of my Dart cloud function, learned that it can't be done when the package is in a different folder in the project.

So I tried 2 other options and got error so shearing here with you to understand if it is possible.

  1. Copy the pacakge into the cloud function folder and referance it in the pubspec.yaml as ''' dependencies: path: dart_core

'''

For this one I am getting the error as if it can't find the folder, and it exist insid of the cloud function when deployed. ''' Resolving dependencies... Because llm depends on dart_core from path which doesn't exist (could not find package dart_core at "dart_core"), version solving failed. '''

  1. Use a symbolic link to the package location, tried that and it didn't worked, seems less likely to work then option one.

This is my function config, dart_core is inside of llm folder ''' 'id': server.llmFunctionId, 'runtime': 'dart-3.5', 'entrypoint': 'lib/main.dart', 'timeout': 90, 'specification': 's-0.5vcpu-512mb', 'execute': ['any', 'guests'], 'name': 'llm', 'enabled': true, 'logging': true, 'scopes': <String>[], 'events': <String>[], 'schedule': '', 'commands': 'dart pub get', 'path': 'functions/llm', '''

TL;DR
Developers are trying to use a local package inside a cloud function. They are experiencing issues referencing the package correctly in the pubspec.yaml file. One suggestion is to include the package in the cloud function folder and reference it with the correct path. Additionally, trying to use symbolic links did not work. The function config provided shows that the path to the package is within the llm folder.
Steven
17 Aug, 2025, 03:31

Are you deploying from GitHub?

What's your folder structure?

guyluz11
17 Aug, 2025, 22:22

Deploying using appwrite-cli npm package locally on my computer

Folder structure:

project_folder functions - Appwrite folder llm - dart project folder dart_core - a full copy of dart package folder att - dart project folder dart_core - a full copy of dart package folder

packages - just a folder dart_core - the original code of the dart package

fronted - a flutter project that use dart_core package

guyluz11
17 Aug, 2025, 22:22

.

Steven
18 Aug, 2025, 04:17

This folder structure looks fine

Steven
18 Aug, 2025, 04:18

And the path is to the LLM folder so that's good.

Steven
18 Aug, 2025, 04:18

However I'm not sure if your pubspec.yaml is right

guyluz11
18 Aug, 2025, 22:00

You are right, I pasted the wrong one

It is

TypeScript
dependencies:
  dart_core:
    path: dart_core

Is there a record of somebody trying to add a local package in a cloud function and succeeding?, mayne open source project which I can compere my code to?.

guyluz11
18 Aug, 2025, 23:46

.

Steven
19 Aug, 2025, 03:27

What if you do:

TypeScript
path: ./dart_core
Steven
19 Aug, 2025, 03:28

And I'm assuming you did dart pub get locally and it works?

Steven
19 Aug, 2025, 03:30

And in dart_core there's pubspec.yaml where name is dart_core?

guyluz11
19 Aug, 2025, 11:05

path: ./dart_core didn't worked,

dart pub get does work locally

"And in dart_core there's pubspec.yaml where name is dart_core?" yep, "name: dart_core"

Could it be a problem with appwrite code excluding packages directories?

Steven
19 Aug, 2025, 14:21

The CLI pushes everything in the path folder so it should be there. What if you download the deployment to verify all the folders are there?

guyluz11
22 Aug, 2025, 11:11

Didn't know that it is option, what is the command for that?.

guyluz11
22 Aug, 2025, 11:11

.

Steven
22 Aug, 2025, 16:49

You should be able to go to the Appwrite Console, find the deployment, click on the menu/action button and then download

Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more