alchemy-swift / alchemy Goto Github PK
View Code? Open in Web Editor NEWModern, batteries included web framework for Swift.
Home Page: https://alchemyswift.com
License: MIT License
Modern, batteries included web framework for Swift.
Home Page: https://alchemyswift.com
License: MIT License
Hi, I'm having some issues running the default full stack server.
I generated the project after downloading the alchemy tool using mint and creating the project with:
$ ~/.mint/bin/alchemy new AlchemyDemo
and choosing the server only option
and then running swift run
and letting the dependencies download. When that's done, the server runs just fine, but only for the first request. Here's the traceback I see:
$ swift run
[0/0] Build complete!
2022-01-17T16:38:22-0500 info Alchemy : [Environment] loaded env from `.env`.
2022-01-17T16:38:22-0500 info Alchemy : [Server] listening on 127.0.0.1:3000.
2022-01-17T16:38:42-0500 info Alchemy : GET /
2022-01-17T16:38:42-0500 info Alchemy : 200 GET / 0.00s
2022-01-17T16:38:42-0500 info Alchemy : GET /styles/home.css
2022-01-17T16:38:42-0500 info Alchemy : GET /js/home.js
2022-01-17T16:38:42-0500 info Alchemy : 200 GET /js/home.js 0.00s
2022-01-17T16:38:42-0500 info Alchemy : 200 GET /styles/home.css 0.00s
/Users/me/Developer/AlchemyDemo/.build/checkouts/swift-nio/Sources/NIOCore/ChannelPipeline.swift:1765: Precondition failed
/Users/me/Developer/AlchemyDemo/.build/checkouts/swift-nio/Sources/NIOCore/ChannelPipeline.swift:1765: Precondition failed
zsh: trace trap swift run
Any idea?
The following code
import Alchemy
struct App: Application {
func boot() {
get("/") { req in
"Hello World!"
}
}
}
App.main()
Generates the error
Fusion/Container.swift:219: Fatal error: Unable to resolve service of type Queue! Perhaps it isn't registered?
2021-10-04 10:20:23.968686+0100 Run[32116:19809202] Fusion/Container.swift:219: Fatal error: Unable to resolve service of type Queue! Perhaps it isn't registered?
This is with swift 5.4
Snipped output here, full log attached below:
[I] me@host:~/
➤ alchemy new myproj
🧪 Cloning quickstart
🧪 Which template would you like to use?
0: Server: server only.
1: Fullstack iOS: a single project with Backend, iOS, & Shared targets.
> 0
🧪 Created project at 'myproj'
[I] me@host:~/
➤ cd myproj/
[I] me@host:~/myproj|HEAD⚡?
➤ swiftenv local 5.4
[I] me@host:~/myproj|HEAD⚡?
➤ swift build
Fetching https://github.com/alchemy-swift/alchemy from cache
[...snip fetching, cloning, updating...]
Resolving https://github.com/swift-server/swift-backtrace.git at 1.3.1
[1/904] Compiling _NIODataStructures Heap.swift
[2/904] Compiling _NIODataStructures PriorityQueue.swift
[3/905] Merging module _NIODataStructures
[4/927] Compiling SwiftCLI ArgumentList.swift
myproj/.build/checkouts/SwiftCLI/Sources/SwiftCLI/Task.swift:55:26: warning: 'launchPath' is deprecated: renamed to 'executableURL'
self.process.launchPath = executable
^
[...snip more warnings and 'compiling' messages...]
myproj/.build/checkouts/alchemy/Sources/Alchemy/Alchemy+Papyrus/Endpoint+Request.swift:52:33: error: cannot find 'parameters' in scope
parameters: try parameters(dto: dto),
^~~~~~~~~~
myproj/.build/checkouts/alchemy/Sources/Alchemy/Alchemy+Papyrus/Endpoint+Request.swift:78:33: error: cannot find 'parameters' in scope
parameters: try parameters(dto: .value),
^~~~~~~~~~
myproj/.build/checkouts/alchemy/Sources/Alchemy/Alchemy+Papyrus/Endpoint+Request.swift:111:27: error: value of type 'HTTPComponents' has no member 'bodyEncoding'
if parameters.bodyEncoding == .json {
~~~~~~~~~~ ^~~~~~~~~~~~
myproj/.build/checkouts/alchemy/Sources/Alchemy/Alchemy+Papyrus/Endpoint+Request.swift:114:34: error: value of type 'HTTPComponents' has no member 'bodyEncoding'
} else if parameters.bodyEncoding == .urlEncoded,
~~~~~~~~~~ ^~~~~~~~~~~~
myproj/.build/checkouts/alchemy/Sources/Alchemy/Alchemy+Papyrus/Router+Endpoint.swift:62:11: error: cannot find type 'PapyrusValidationError' in scope
extension PapyrusValidationError: ResponseConvertible {
^~~~~~~~~~~~~~~~~~~~~~
myproj/.build/checkouts/alchemy/Sources/Alchemy/Alchemy+Papyrus/Router+Endpoint.swift:120:41: error: cannot find type 'BodyEncoding' in scope
public func decodeBody<T>(encoding: BodyEncoding = .json) throws -> T where T: Decodable {
^~~~~~~~~~~~
myproj/.build/checkouts/alchemy/Sources/Alchemy/Alchemy+Papyrus/Router+Endpoint.swift:70:17: error: instance method 'header(for:)' has different argument labels from those required by protocol 'DecodableRequest' ('header')
public func header(for key: String) -> String? {
^ ~~~
[...snip many more errors...]
Full build log here:
alchemy-build.log
Hi - just trying to have a look at alchemy and following the instructions to get started, but getting an error when installing.
Using Xcode 13 (is that the issue?)
% mint install alchemy-swift/alchemy-cli
🌱 Finding latest version of alchemy-cli
🌱 Cloning alchemy-cli v0.0.3
🌱 Resolving package
🌱 Building package
remark: Incremental compilation has been disabled: it is not compatible with whole module optimizationremark: Incremental compilation has been disabled: it is not compatible with whole module optimizationremark: Incremental compilation has been disabled: it is not compatible with whole module optimizationremark: Incremental compilation has been disabled: it is not compatible with whole module optimization[1/5] Compiling SwiftCLI ArgumentList.swift
/private/var/folders/cy/9zm9f0ps07l19d64khr89r1w0000gn/T/mint/github.com_alchemy-swift_alchemy-cli/.build/checkouts/SwiftCLI/Sources/SwiftCLI/Command.swift:11:27: warning: using 'class' keyword to define a class-constrained protocol is deprecated; use 'AnyObject' instead
public protocol Routable: class {
^~~~~
AnyObject
/private/var/folders/cy/9zm9f0ps07l19d64khr89r1w0000gn/T/mint/github.com_alchemy-swift_alchemy-cli/.build/checkouts/SwiftCLI/Sources/SwiftCLI/Option.swift:9:25: warning: using 'class' keyword to define a class-constrained protocol is deprecated; use 'AnyObject' instead
public protocol Option: class, CustomStringConvertible {
^~~~~
AnyObject
/private/var/folders/cy/9zm9f0ps07l19d64khr89r1w0000gn/T/mint/github.com_alchemy-swift_alchemy-cli/.build/checkouts/SwiftCLI/Sources/SwiftCLI/Stream.swift:13:33: warning: using 'class' keyword to define a class-constrained protocol is deprecated; use 'AnyObject' instead
public protocol WritableStream: class {
^~~~~
AnyObject
/private/var/folders/cy/9zm9f0ps07l19d64khr89r1w0000gn/T/mint/github.com_alchemy-swift_alchemy-cli/.build/checkouts/SwiftCLI/Sources/SwiftCLI/Stream.swift:187:33: warning: using 'class' keyword to define a class-constrained protocol is deprecated; use 'AnyObject' instead
public protocol ReadableStream: class {
^~~~~
AnyObject
/private/var/folders/cy/9zm9f0ps07l19d64khr89r1w0000gn/T/mint/github.com_alchemy-swift_alchemy-cli/.build/checkouts/SwiftCLI/Sources/SwiftCLI/Task.swift:286:37: error: value of optional type 'UnsafeMutablePointer?' (aka 'Optional<UnsafeMutablePointer>') must be unwrapped to a value of type 'UnsafeMutablePointer' (aka 'UnsafeMutablePointer')
defer { argv.forEach { free($0)} }
^
/private/var/folders/cy/9zm9f0ps07l19d64khr89r1w0000gn/T/mint/github.com_alchemy-swift_alchemy-cli/.build/checkouts/SwiftCLI/Sources/SwiftCLI/Task.swift:286:37: note: coalesce using '??' to provide a default when the optional value contains 'nil'
defer { argv.forEach { free($0)} }
^
?? <#default value#>
/private/var/folders/cy/9zm9f0ps07l19d64khr89r1w0000gn/T/mint/github.com_alchemy-swift_alchemy-cli/.build/checkouts/SwiftCLI/Sources/SwiftCLI/Task.swift:286:37: note: force-unwrap using '!' to abort execution if the optional value contains 'nil'
defer { argv.forEach { free($0)} }
^
!
/private/var/folders/cy/9zm9f0ps07l19d64khr89r1w0000gn/T/mint/github.com_alchemy-swift_alchemy-cli/.build/checkouts/SwiftCLI/Sources/SwiftCLI/Task.swift:300:55: error: value of optional type 'UnsafeMutablePointer?' must be unwrapped to a value of type 'UnsafeMutablePointer'
free(UnsafeMutableRawPointer(pair.pointee))
^
/private/var/folders/cy/9zm9f0ps07l19d64khr89r1w0000gn/T/mint/github.com_alchemy-swift_alchemy-cli/.build/checkouts/SwiftCLI/Sources/SwiftCLI/Task.swift:300:55: note: coalesce using '??' to provide a default when the optional value contains 'nil'
free(UnsafeMutableRawPointer(pair.pointee))
^
?? <#default value#>
/private/var/folders/cy/9zm9f0ps07l19d64khr89r1w0000gn/T/mint/github.com_alchemy-swift_alchemy-cli/.build/checkouts/SwiftCLI/Sources/SwiftCLI/Task.swift:300:55: note: force-unwrap using '!' to abort execution if the optional value contains 'nil'
free(UnsafeMutableRawPointer(pair.pointee))
^
!
/private/var/folders/cy/9zm9f0ps07l19d64khr89r1w0000gn/T/mint/github.com_alchemy-swift_alchemy-cli/.build/checkouts/SwiftCLI/Sources/SwiftCLI/ValueBox.swift:20:30: warning: using 'class' keyword to define a class-constrained protocol is deprecated; use 'AnyObject' instead
public protocol AnyValueBox: class {
^~~~~
AnyObject
🌱 Encountered error during "swift build -c release -Xswiftc -target -Xswiftc x86_64-apple-macosx11.6". Use --verbose to see full output
🌱 Failed to build alchemy-cli v0.0.3 with SPM
Hey team,
Great work on Alchemy. Been toying with it and I see in the README there is supposed to be async/await support though I had to polyfill for 3.2.0 which is the latest release (unless I'm doing something wrong). Is there supposed to be a 4.0 release? I see Fusion has one late January.
Thanks,
Alejandro
Best wishes
This is a really elegant and thorough micro web framework. The API is pretty intuitive and the documentation is pretty easy to follow. This is a great addition to Server-Side Swift.
Good job to the authors and contributors of Alchemy. Keep it up 👍
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.