-
Notifications
You must be signed in to change notification settings - Fork 33
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
Migrate to the Nhost v2 backend #50
Conversation
828ec5c
to
a11780b
Compare
Support for the v2 backend is a work in progress. There are still a few endpoints that I need to either add or properly test, AND more docs to write, but is solid enough that I'm comfortable pushing out a beta version. Broadly, this release includes support for: * Single URL configuration of `NhostClient`s * Easier GQL client and link creation * Serverless function calls, via `NhostClient.functions` * GraphQL-based storage of file metadata * Pre-signed URLs for sharing of protected files `Storage.getPresignedUrl` * Additional image transformation parameters in `Storage.downloadImage` * Dev server scripts/configs for running the examples * Improved testability with a new test dev server, HTTP proxy support in testing environments, and environment-driven logging
// particularly in the ?all=true case, the user should know about it | ||
} | ||
|
||
await _clearSession(); | ||
return AuthResponse(session: null, user: null); | ||
} | ||
|
||
/// Activates a user. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@shyndman are the confirmations now being handled by nhost directly? For example activation of the account, confirm email change, confirm password change. I see there is an optional redirect now. Is the intention that if not provided then nhost will manage it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @pjindal91,
Yes, that's correct. Nhost sends out an email containing a link to an Nhost-managed confirmation endpoint. Upon confirmation, the user will be redirected to the address you've specified (which can be an app/universal link).
If not provided, the user will be redirected to an application default, specified via the AUTH_CLIENT_URL
environment variable.
Note that it appears there are some other rules surrounding this. You can't redirect to arbitrary URLs. The logic is here: https://github.com/nhost/hasura-auth/blob/main/src/helpers.ts#L150
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah got it. Thanks for the explanation @shyndman
@@ -0,0 +1,41 @@ | |||
import 'package:http/http.dart' as http; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is dart supported by nhost now in addition to js/ts? How are endpoints specified?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, no Dart at the moment, although I'd definitely file a request over at https://github.com/nhost/nhost
Although sparse, the docs here describe how the process works for JS/TS
(It looks like there may be Go support in there as well? I saw something in the code that made me think it, but I haven't tried it out)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Got it @shyndman, then what is the purpose of this function? I misunderstood as serverless functions that are provided by nhost
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a client for calling serverless functions.
Maybe I need a better name?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah understood. Maybe name could be else but i think documentation could be enough as well. I was looking at it without documentation hence got bit confused.
A question i have is why is it always making a post request? https://github.com/nhost/nhost-dart/pull/50/files/f0d0056b3e295ec7add49a99dcf933156682b0e6#diff-4be4a0d206d165857c3d6c4f69537dd96a82bf1da61223ba714539337db95fe2R34
I believe the serverless functions right now support both get and post. Wouldnt this cause inconsistency between the sdk and the nhost serverless function support?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Want to file it as a feature request? I'll get to it tomorrow.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes I can do that. Also with v2 i dont know if things have changed and now the serverless function routes are only supported for POST. I know previously it used to support POST, GET and possibly DELETE as well. So maybe worth checking with Nhost team if that still is the case.
Also I dont think i need that feature right now, i was just going through the code to understand more about V2 and saw that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like all verbs are supported: https://github.com/nhost/cli/blob/2b01ba4c326c766b939b971ac20accc24f86e60c/functions/functions.go#L78
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, then might sense to have that support here as well for 2 reasons i believe:
- Consistency in the functionality supported by infrastructure and sdk
- Based on principle of least surprises, the user would be aware what kind of request is being made instead of automatic post request everytime
Created #55 as well
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you
This release is a work in progress.
There are still a few endpoints that I need to either add or properly test, and more docs to write, but is solid enough that I'm comfortable pushing out a beta version.
Broadly, this release includes support for:
NhostClient
sNhostClient.functions
Storage.getPresignedUrl
Storage.downloadImage
testing environments, and environment-driven logging
Related to #51