I'm using the Appwrite CLI to initialize a new function. When I open the generated Package.swift file, I fix a build error and update the Appwrite package dependency to 4.0.1. However, there is one final build error in the generated index.swift source file that I can't figure out. Any ideas on what I'm missing here?
Summary
The user is experiencing a build error when deploying their Apple/Swift function with a context object. They found a workaround by copying open runtime files into their package and adding Vapor as a dependency. They also shared a link to a runtime context implementation. The user is unsure of the implementation for these objects in the template repo. Another user suggests increasing the function memory environment variable. The user also mentions seeing Docker errors and warnings in the logs. There is a discussion about self-hosting and the logs being hard to read when mixed together. The user is using the Appwrite CLI to initialize a new function and is encountering build errors in the generated
Drake
Admin
Oct 31, 2023, 00:39
this looks like a local error because your local IDE doesn't have those types.
Drake
Admin
Oct 31, 2023, 00:39
is there a problem when you deploy it?
Hamlin111
Apple Developer
Oct 31, 2023, 01:51
The build fails when I deploy with the CLI. The build also fails when I init from the CLI and then immediately deploy
Drake
Admin
Oct 31, 2023, 01:53
What's the build error?
Hamlin111
Apple Developer
Oct 31, 2023, 01:58
I'm seeing "Docker Error: Preparing for build" and some warnings in the logs
Hamlin111
Apple Developer
Nov 1, 2023, 22:34
Drake
Admin
Nov 1, 2023, 23:18
oh you're self hosting?
Drake
Admin
Nov 1, 2023, 23:19
it would be best to get logs of specific containers. it's hard to read when mixed together
Hamlin111
Apple Developer
Nov 1, 2023, 23:45
Yes to self hosting. And are these the correct logs?
Drake
Admin
Nov 3, 2023, 14:27
Ya build and executor
I can't quite tell why it failed 🧐
Drake
Admin
Nov 3, 2023, 14:28
What version of Appwrite?
Drake
Admin
Nov 3, 2023, 14:28
NVM I see it's 1.4.7
Drake
Admin
Nov 3, 2023, 14:29
Maybe you can try increasing the function memory environment variable in your .env file. Swift usually takes a lot of resources
I was going to see if I could translate an implementation for these objects, but it appears that all the typed languages in the template repo (https://github.com/appwrite/templates) reference this RuntimeContext without an implementation.
A hacky quick way to compile locally is to copy the open runtime files into your package and add Vapor as dependency, then you can compile your function package with Xcode or xcodebuild. When deploying just ignore or delete the runtime files.