Back

Apple/Swift Function with Context Object Build Error

  • 0
  • Self Hosted
  • Functions
  • Apple
Hamlin111
30 Oct, 2023, 23:33

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?

TL;DR
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
31 Oct, 2023, 00:39

this looks like a local error because your local IDE doesn't have those types.

Drake
31 Oct, 2023, 00:39

is there a problem when you deploy it?

Hamlin111
31 Oct, 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
31 Oct, 2023, 01:53

What's the build error?

Hamlin111
31 Oct, 2023, 01:58

I'm seeing "Docker Error: Preparing for build" and some warnings in the logs

Hamlin111
1 Nov, 2023, 22:34
Drake
1 Nov, 2023, 23:18

oh you're self hosting?

Drake
1 Nov, 2023, 23:19

it would be best to get logs of specific containers. it's hard to read when mixed together

Hamlin111
1 Nov, 2023, 23:45

Yes to self hosting. And are these the correct logs?

Drake
3 Nov, 2023, 14:27

Ya build and executor

I can't quite tell why it failed 🧐

Drake
3 Nov, 2023, 14:28

What version of Appwrite?

Drake
3 Nov, 2023, 14:28

NVM I see it's 1.4.7

Drake
3 Nov, 2023, 14:29

Maybe you can try increasing the function memory environment variable in your .env file. Swift usually takes a lot of resources

SonOfBoo
21 Dec, 2023, 01:13

I'm seeing this same error. It appears that the Appwrite Swift SDK doesn't contain either of these classes: https://github.com/appwrite/sdk-for-swift/tree/main/Sources/AppwriteModels

SonOfBoo
21 Dec, 2023, 01:40

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.

Triple Gelato
22 Dec, 2023, 07:21

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.

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