Edit: I have a feeling Iām doing something wrong, I keep redoing the tutorial and getting new errors. Iāll try work out what Iām doing wrong sorry.
Yes sorry, all sorted and got it working now, I just confused myself with the āHelloVaporā project and āhelloā page. Should have watched to the end of the vid first.
Can I build my Vapor 3 project on Ubuntu ECS ?
I couldnāt make it work in a browser until I tried the solution found in this thread:
services.register { _ in
EngineServerConfig.detect(hostname: "127.0.0.1", port: 8080)
}
Now it works with this port. Can anyone help me figure out whatās wrong and why localhost:8080 doesnāt work?
Iām sure I donāt know whatās supposed to be in there. Here whatās in it.
##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting. Do not change this entry.
##
127.0.0.1 localhost
255.255.255.255 broadcasthost
::1 localhost
Anything wrong with that?
@dricard bizarre! That looks completely valid
If you run ping localhost
in terminal does it work? If you remove the solution you added and try running your application what gets printed in the console?
Yes if I ping localhost it works. When I remove the solution and I run this is what I get in the console:
Migrating sqlite DB
Migrations complete
Server starting on http://localhost:8080
And when I load http://localhost:8080/hello I get this in Safari:
It does the same in Firefox:
With the solution:
Migrating sqlite DB
Migrations complete
Server starting on http://127.0.0.1:8080
And loading http://127.0.0.1:8080/hello
in Safari works (I get āHello Worldā).
That is bizarre! Does a curl -v http://localhost:8080/hello
work at all?
Speaking to some others it may be an IPv6 issue - this should be fixed by the integration of Swift NIO soon
This is what I get from the curl:
* Trying ::1...
* TCP_NODELAY set
* Connected to localhost (::1) port 8080 (#0)
> GET /hello HTTP/1.1
> Host: localhost:8080
> User-Agent: curl/7.54.0
> Accept: */*
>
* Empty reply from server
* Connection #0 to host localhost left intact
curl: (52) Empty reply from server
Trying with the solution returns this instead:
* Trying 127.0.0.1...
* TCP_NODELAY set
* Connected to 127.0.0.1 (127.0.0.1) port 8080 (#0)
> GET /hello HTTP/1.1
> Host: 127.0.0.1:8080
> User-Agent: curl/7.54.0
> Accept: */*
>
< HTTP/1.1 200 OK
< Content-Length: 13
< Content-Type: text/plain; charset=utf-8
< Date: Wed, 07 Mar 2018 17:55:05 GMT
<
* Connection #0 to host 127.0.0.1 left intact
Hello, world!
@dricard ok so itās definitely preferring IPv6 over IPv4 - looks like thereās an issue around packets/streams for IPv6. The good news is this should be fixed pretty soon. As for why it is happening - if you add another line at the bottom of your /etc/hosts
for 127.0.0.1 localhost
to see if it picks that over IPv6 address - or wait for the fix with your workaround til then!
@0xtim thanks for looking into this for me! I guess Iāll keep the workaround until this is resolved. Where should I look for info on a possible fix?
@0xtim hello budā¦im running into a issue. everything is installed, Xcode toolchains is switched but it will not allow me to run the āvapor new HelloVapor --branch=betaā.
What is the error message you get? Knowing the error message could be useful in figuring out what is going on ā¦
got it working bud, TY though!
Iāve got 4.1 installed and vapor, however I canāt get the web server to launch. Iāve deleted and recreated the app several times. I get the following error:
[ INFO ] Migrating āsqliteā database (FluentProvider.swift:28)
[ INFO ] Preparing migration āTodoā (MigrationContainer.swift:50)
[FluentError.reflectProperty: No property reflected for Swift.WritableKeyPath<App.Todo, Swift.Optional<Swift.Int>>] [/Users/maxfred/code/swift/vapor/HelloVapor/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Migration/Migration.swift:28:124]
Program ended with exit code: 1
@midtownkc run vapor update
there was a broken reflection API in Core that for some reason still is being used by the template - Iāll get that updated