Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sslUnsupported #4

Closed
ladiesman218 opened this issue Dec 29, 2023 · 8 comments
Closed

sslUnsupported #4

ladiesman218 opened this issue Dec 29, 2023 · 8 comments

Comments

@ladiesman218
Copy link
Contributor

When trying to start the app, it errored out saying:

error codes.vapor.application : database-id=psql [AsyncKit] Opening new connection for pool failed: PSQLError(code: sslUnsupported)

This should be an tlsConfiguration error, right?

I didn't change anything other than set up a postgres db myself

@petrpavlik
Copy link
Owner

@ladiesman218 I assume you are trying to launch the app connected to a postgres running on your machine (via docker ot otherwise)? You can try to always disable SSL by using tlsConfiguration: app.environment == .none instead of tlsConfiguration: app.environment == .testing ? .none : .forClient(certificateVerification: .none)), or do .testing or .debug instead of just .testing. Also make sure that the port is correct.

@ladiesman218
Copy link
Contributor Author

ladiesman218 commented Dec 29, 2023

I've changed to tlsConfiguration: .none, now xCode is unhappy...
The compiler is unable to type-check this expression in reasonable time; try breaking up the expression into distinct sub-expressions

image

@petrpavlik
Copy link
Owner

petrpavlik commented Dec 29, 2023

I think that you have an extra ) at the end.

Anyway, I just tried in one of my projects, and it compiles fine for me. Try to copy-paste this

app.databases.use(DatabaseConfigurationFactory.postgres(configuration: .init(
        hostname: Environment.get("DATABASE_HOST") ?? "localhost",
        port: Environment.get("DATABASE_PORT").flatMap(Int.init(_:)) ?? (app.environment == .testing ? 5433 : 5432),
        username: Environment.get("DATABASE_USERNAME") ?? "vapor_username",
        password: Environment.get("DATABASE_PASSWORD") ?? "vapor_password",
        database: Environment.get("DATABASE_NAME") ?? "vapor_database",
        tlsConfiguration: .none)
    ), as: .psql)

@ladiesman218
Copy link
Contributor Author

Thx, that solves the issue, but it still cause a xCode warning says:
'postgres(configuration:maxConnectionsPerEventLoop:connectionPoolTimeout:encoder:decoder:sqlLogLevel:)' is deprecated: Use .postgres(configuration:maxConnectionsPerEventLoop:connectionPoolTimeout:encodingContext:decodingContext:sqlLogLevel:) instead.
I checked source code in DatabaseConfigurationFactory, it's just xCode being hallucinated, never mind

@ladiesman218
Copy link
Contributor Author

ladiesman218 commented Dec 29, 2023

Got another thing that I can't understand. Profile means user, right? When I'm posting to localhost:8080/profile, that means user registration? If yes, I'm getting Unauthorized as the response, really hard to make sense out of it. It's checking for FirebaseJWTPayload, do I need JWTToken to register as a new user?

Edit:
Sorry I throw this under the same issue, should I move it to a new one?

@petrpavlik
Copy link
Owner

Yeah, it shows a deprecation warning, I'll take a look at what API should be used as a replacement. Please do open a new issue for the JWT issue.

@petrpavlik
Copy link
Owner

But yes, this project uses firebase auth for user authentication. You'll need to create a firebase project and create a firebase user through their REST API https://firebase.google.com/docs/reference/rest/auth#section-create-email-password or one of the SDKS (iOS, web, ...). You can refer to the unit tests of this project for more info.

@ladiesman218
Copy link
Contributor Author

Made a pull request about the new API. #5

Yeah, it shows a deprecation warning, I'll take a look at what API should be used as a replacement. Please do open a new issue for the JWT issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants