961
questions
0
votes
0
answers
48
views
Swift Vapor 4 server scheduling a task with deadline is off
I'm using the following code to schedule a future task on a Swift Vapor Server. The expectation is that the task executes exactly at the start of the next hour (regardless of how much time has elapsed ...
0
votes
1
answer
43
views
Swift Vapor Server Error When Building Docker on Fly.io
I have built a vapor server that is running fine on a mac server on HostMyApple. I'm trying to migrate to fly.io. When I run the command "fly launch" it begins building but then gives these ...
1
vote
1
answer
41
views
How to execute postgresql or sql directly using fluent orm
I am writing a vapor application, and I am having trouble because I need to index a geohash, but it isn't easily available, now i'd like to use SQL or postgres directly however, I'm at a loss for how ...
1
vote
0
answers
46
views
Vapor PSQLError: sqlState: 42883, file: parse_oper.c, hint: No operator matches the given name and argument types
I added a new function to my vapor server to query a postgres database for appointments using a userID.
func getAppointmentsByResidentID(req: Request) throws -> EventLoopFuture<[Appointment]> ...
2
votes
1
answer
91
views
Vapor server: Fatal error: Cannot access field before it is initialized or fetched: address
I have a vapor (4) server and recently added a function to query the database for a resident using an email address:
func getResidentByEmail(req: Request) throws -> EventLoopFuture<Resident> {...
1
vote
1
answer
146
views
Uploading an image with the format jpg, jpeg, png, heic to Vapor 4. Sending a file from an iOS application written in SwiftUI
I can't write the code for uploading images in any way.
Need to do this: a request is sent from the iOS application (SwiftUI) to the backend, then the file format (jpg, jpeg, png, heic) is checked in ...
1
vote
2
answers
76
views
supervisor error log: sudo: a terminal is required to read the password
I am trying to use supervisord to daemonize a vapor server. This is my first time doing so. I am getting this one and only error in the supervisor error log:
sudo: a terminal is required to read the ...
0
votes
1
answer
72
views
Docker Error: Load Metadata For Docker.io/library/swift:5.9
I'm attempting to dockerize a vapor server. I'm on a Mac M1, hoping to use the docker image on Ubuntu 22.04 server. I get an error when trying to build (see below in the picture). Any ideas on why I'm ...
0
votes
0
answers
43
views
Illegal Instruction Error when Building Vapor Project on Server
My vapor project runs fine on my local machine, but when I try to build it on the server (Ubuntu 22.04) I get an error. I installed Swift and Vapor on the server prior to building the project. The ...
1
vote
1
answer
113
views
Postman GET Returns Successful but SwiftUI App GET Returns Decode Error
I am running a vapor server. My app network requests are all working perfectly except for getOrders. When running the request on Postman it returns successfully. Can anyone see what Postman does to ...
-3
votes
1
answer
92
views
How to reconnect MySQL database in Vapor?
I am using Vapor framework form server-side back-end using Swift in Ubuntu. In the 80% project done and this framework not reconnecting database automatically. I just need solution to reconnect ...
1
vote
1
answer
158
views
Using Vapor to redirect request
I am using new to using Vapor and we want to use it as a way to alternate between a mock server and a real server.
In my client application in Xcode we may call the real-server (e.g. realbase.com/a/b/...
1
vote
1
answer
52
views
How do I Decode Postgres NUMERIC to Vapor Fluent Optional<Float>?
I've created a Vapor Fluent model that has the following properties, several of which are optional:
final class Skill: Model, Content {
static let schema = "skills"
/// Tells ...
0
votes
0
answers
75
views
Swift Timer doesn't work on Linux. Works on macOS
I noticed an issue with Swift's Timer, and I'm not sure if this is a Swift problem, a problem with a library I'm using, or a problem with my code. I have the following Timer:
var updateTimestampTimer =...
0
votes
0
answers
58
views
Streaming multiple payloads through a response on swift Vapor 4
I need a way to send data to my client ios app from vapor backend on stream.
I'm using openAI chat complation.
I used these code on my vapor backend, but these just retrieve reponse on a single ...
2
votes
1
answer
49
views
Detect type of vapor worker at runtime
We have a Vapor API which uses a web worker, a queues worker and a scheduled queues worker. Every worker has the same configure(_ app: Application) function.
In this function, I'd like to find the ...
1
vote
1
answer
102
views
Does setting a .unique(on:) constraint affect the uniqueness of the .id in fluent/vapor?
As the title says:
Does setting a .unique(on:) affect the .id in fluent/vapor?
I have a "user" schema which has a .id and is also .unique(on: email). Now I have noticed that I have entries ...
1
vote
1
answer
237
views
Connect MySQL configuration with CA certificate?
I am using mysqlkit for Vapor server side project and used to configure MySQL like below:
let config = MySQLConfiguration(hostname: "127.0.0.1", port: 3306, username: "root", ...
-1
votes
1
answer
155
views
How to install swift core libraries in production ubuntu server?
I've two ubuntu server 22.04.4 machines. One is in local for development and another one is in server for deployment.
I tested the release build in the local and transfer the executable from local ...
1
vote
2
answers
88
views
Vapor Fluent OR relationship
I have a two models in Vapor using Fluent as the ORM, one is a Transaction and the other is an Invoice. The Transaction model has the below:
@OptionalParent(key: "invoice_id")
var invoice: ...
1
vote
0
answers
60
views
How can I send an image and a JSON together from my Swift client side to my vapor server side?
I'm currently developing the registration feature for my SwiftUI app and need to send user registration data, including a profile image selected by the user, to my Vapor server. I've heard that using ...
1
vote
1
answer
278
views
How to send multipart form data request with vapor client
I am trying to send a request to openai's speech to text api in my vapor app. The api accepts multipart/form-data requests. I couldn't figure out how to use vapor's client api. For json requests one ...
0
votes
1
answer
76
views
How to remove Duplicate items from siblings filter in Fluent Vapor 4?
I have a query in Fluent Vapor that applies siblings filters based on metaTagIds. Here's the code snippet:
let queryBuilder = Attraction.query(on: req.db)
if let metaTagIds = attractionSearch....
1
vote
0
answers
243
views
Passkeys and Apple Associated Domains
I've been trying to implement passkeys. I keep running into apple-app-site-association issues.
Error: The operation couldn’t be completed. Application with identifier abc is not associated with ...
0
votes
1
answer
58
views
Try to use SES Services with Soto SDK and Vapor 4 to send email with my own route
I want to use SES Services with Vapor 4 to send an Email with my own route.
I follow step by step the recommendation in Soto Doc to use Vapor 4.
But I got this error :
AsyncHTTPClient/HTTPClient.swift:...
2
votes
1
answer
115
views
Swift Vapor Console App - The operation couldn’t be completed. Permission denied
I am developing a Swift Vapor app. I want to access the Terminal app (among other apps).
The user will enter a front-end Terminal command and it will be performed by the backend server and the result ...
0
votes
1
answer
469
views
Local development with the apple-app-site-association file
I’m trying to locally test my passkey implementation. My Vapor server is hosted on localhost, on port 8080.
During the passkey authentication process the apple-app-site-association file must be within ...
1
vote
1
answer
118
views
Migrating an Enum in Vapor using AsyncMigration
How would one migrate an enum using AsyncMigration? There are a few examples online of migrating one using the EventLoopFuture, but my preference is to use Swift Concurrency.
1
vote
1
answer
131
views
How to represent dates consistently between a GraphQL server and client?
I'm struggling to understand how best to represent dates and ensure they can be encoded and decoded consistently between Service and Client when both the service and client and written in Swift.
For ...
1
vote
1
answer
325
views
XCTest Test runner never began executing tests after launching
I am doing a simple XCTest setup using Vapor (XCTVapor) and a Python Test as app dependencies, but it never executes my tests.
,
After 5 minutes it terminates saying, 'Test runner never began ...
1
vote
1
answer
146
views
Linker (ld: Undefined Symbols) error while using package AsyncHTTPClient through Vapor
I am linking with the Vapor library pulling in the package through Package Dependencies in xcode Project, and then in my Target I link Binary with Libraries I am linking with Vapor. Vapor itself ...
2
votes
1
answer
72
views
iOS Vapor Js not found
My iOS project. I added code for Vapor by adding 'Server' folder in basic structure.
import Vapor
import Leaf
extension URL {
static func documentsDirectory() throws -> URL {
try ...
1
vote
0
answers
71
views
Sorting Query Results by Title in Vapor-Fluent
Query in Fluent, I'm attempting to sort the results by title in Danish language. The current code is functional, but it seems that characters like å, æ, and ø are not being sorted correctly. Does ...
2
votes
1
answer
121
views
How can I verify SNS messages in a server-side Swift HTTPS endpoint?
Amazon provides documentation for verifying that SNS messages routed to an HTTP/HTTPS endpoint are valid. Using Vapor and Swift on the server, along with swift-certificates and swift-crypto, I ...
1
vote
1
answer
132
views
Get result of async function in sync function
How can I convert this code to async await?
func syncFunction() -> String {
let result: String = try myEventLoopFutureWithResult.wait()
return result
}
I have tried this approach so far, ...
1
vote
1
answer
124
views
How do I commit a Vapor project to GitHub?
I'm getting started with Vapor and created a new hello-world Vapor project. However if I want to commit this project to my GitHub repo using GitHub Desktop, I don't really see any files to commit even ...
1
vote
0
answers
116
views
Nil value for required field of sibling relation in vapor / fluent causes fatal error
I have a question about fluent / vapor. Maybe someone here has an idea and can help me.
I have a sibling relation which I want to eager-load when fetching an entity.
let all = try await ExerciseBase
...
1
vote
2
answers
215
views
Vapor project swift run App serve --env production does not work
I follow the Vapor doc and try to deploy my project. I tried to run
swift run App serve --env production
or
.build/release/App serve --env production
[Vapor] ConsoleKit.ConsoleError(identifier: "...
1
vote
1
answer
114
views
Vapor(4.77) Leaf(4.2.4) 101: Unable to render a child leaf within its parent leaf (template)
Environment:
Vapor v4.77
Leaf v4.2.4
Neophyte Goal: To incorporate a child leaf into its parent leaf (template).
Scenario: Rendering the basic "hello" world is fine. It works as a stand-...
3
votes
1
answer
567
views
How do I generate a presigned URL using the AWS SDK for Swift?
I'm using Vapor to build a server side Swift application and I'm using the AWS SDK for Swift for interacting with S3.
I want to create a pre-signed URL for an object so that users can download and ...
1
vote
1
answer
212
views
Vapor Logger doesn't log any messages into System Log
Environment:
Vapor 4.77
MacOS 13.5
Running on LocalHost:8080
Scenario:
I've created a subclass within Vapor's app.logger to collect logs.
Add set the logger base level to .info.
I've added a log ...
1
vote
0
answers
49
views
Postgre-Kit: Unable to complete code access to PostgreSQL DB
Goal: To connect to a Postgre database and merely add simple data to a database table.
Environment:
// swift-tools-version:5.9
import PackageDescription
let package = Package(
name: "...
1
vote
1
answer
90
views
How to decide to use siblings or parent/children relations in vapor?
I have a table named posts, and users can add any post to his favorites. From the perspective of the post, this is User(Parent)/Post(children) relation. But a post can be added to any user's favorites,...
3
votes
2
answers
226
views
How to make a optional query filter in Vapor
Here is my code:
var query = Post.query(on: req.db)
if needFilter == true {
query = query.filter(\.$board.$id == boardId)
}
return try await query
.with(\.$profile).all()
...
1
vote
1
answer
44
views
How can I handle empty query parameters in Vapor routes handler
I would like to handle this HTTP GET request http://localhost:8080/route?wsdl and return a static file
I have started with this route handler
app.get("route") { req throws -> ...
1
vote
0
answers
95
views
Unable to acquire ID for POST of Content-Type: Multipart/form-data to Postgre DB via Fluent
Environment: MacOS 13.5.1 Vapor 4.77
Scenario: Attempting to post:
{"title":"String", "description":"String", "Info":"Data"} to a Postgre DB ...
1
vote
1
answer
84
views
how do vapor fluent do a upsert?
I have a table named profile, and my model here:
final class Profile: Model, Content {
struct Keys {
static let userId: FieldKey = "user_id"
static let nickname: FieldKey ...
1
vote
1
answer
70
views
Vapor registered 'ToDo' database yet PostgreSQL doesn't show it from the prompt
Environment: Vapor v4.77
Database: Postgresql@15 via Homebrew
Here's the environment:
/Users/Ric> echo $DATABASE_NAME
ToDo
/Users/Ric> echo $DATABASE_HOST
localhost
/Users/Ric> echo $...
1
vote
1
answer
255
views
NIOCore.ChannelError.connectTimeout(NIOCore.TimeAmount(nanoseconds: 10000000000))
My project with Swift Vapor was working well, and one day, I started getting this warning in the Xcode console and web browser of my development computer. On the server side, the deployed code works ...
1
vote
0
answers
81
views
Vaper Persistent Store ID problem associated with Fluent
Scenario: Using local Postgres DB via Fluent package.
Goal: To produce a simple DB table with two fields: 'Name' (String) and 'Info' (Data).
I'm testing the storage & retrieval of JSON Data via a ...