-
Notifications
You must be signed in to change notification settings - Fork 437
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
server
and port
properties are required when using the custom connector
factory method
#1541
Comments
server
and port
properties are required when using the custom connector factory method
server
and port
properties are required when using the custom connector factory methodserver
and port
properties are required when using the custom connector
factory method
Hi @ruyadorno, thanks for catching this. The current validation logic need to be altered to accommodate the custom connector. if you do not have the band width, I can definitely make the fix later. These are my ideas for fixing this: Under connection.ts, there is a type check to ensure user provide a server value before which throws the error message that you described: if (typeof config.server !== 'string') {
throw new TypeError('The "config.server" property is required and must be of type string.');
} it need to be latered to also check whether custom connector is used. if (typeof config.server !== 'string' && typeof config.connector !== 'function') {
throw new TypeError('The "config.server" property is required and must be of type string if "config.connector" is not used');
} @arthurschreiber , Do you think this message looks OK? For port, it should be ok to leave it empty since it used to be a optional entry. Also, from the code, the connect function seems directly use the socket that returned by custom connector, so it should use whatever port number passed in from the custom connector side and ignore the default value for connection configuration options.port. |
hi @MichaelSun90 thank you for the pointers! That sounds about what I had in mind initially!
I believe that Lines 1903 to 1904 in e4eadf8
Something like |
This changeset fixes a problem in the original custom `connector` factory method implementation that required the `server` config property to be defined even though its value is ignored. Removing the validation when `config.options.connector` is defined fixes the problem. Ref: tediousjs#1540 Fixes: tediousjs#1541 Signed-off-by: Ruy Adorno <[email protected]>
This changeset fixes a problem in the original custom `connector` factory method implementation that required the `server` config property to be defined even though its value is ignored. Removing the validation when `config.options.connector` is defined fixes the problem. Ref: tediousjs#1540 Fixes: tediousjs#1541 Signed-off-by: Ruy Adorno <[email protected]>
This changeset fixes a problem in the original custom `connector` factory method implementation that required the `server` config property to be defined even though its value is ignored. Removing the validation when `config.options.connector` is defined fixes the problem. Ref: tediousjs#1540 Fixes: tediousjs#1541 Signed-off-by: Ruy Adorno <[email protected]>
This changeset fixes a problem in the original custom `connector` factory method implementation that required the `server` config property to be defined even though its value is ignored. Removing the validation when `config.options.connector` is defined fixes the problem. Ref: tediousjs#1540 Fixes: tediousjs#1541 Signed-off-by: Ruy Adorno <[email protected]>
This changeset fixes a problem in the original custom `connector` factory method implementation that required the `server` config property to be defined even though its value is ignored. Removing the validation when `config.options.connector` is defined fixes the problem. Ref: tediousjs#1540 Fixes: tediousjs#1541 Signed-off-by: Ruy Adorno <[email protected]>
This changeset fixes a problem in the original custom `connector` factory method implementation that required the `server` config property to be defined even though its value is ignored. Removing the validation when `config.options.connector` is defined fixes the problem. Ref: tediousjs#1540 Fixes: tediousjs#1541 Signed-off-by: Ruy Adorno <[email protected]>
This changeset fixes a problem in the original custom `connector` factory method implementation that required the `server` config property to be defined even though its value is ignored. Removing the validation when `config.options.connector` is defined fixes the problem. Ref: tediousjs#1540 Fixes: tediousjs#1541 Signed-off-by: Ruy Adorno <[email protected]>
This changeset fixes a problem in the original custom `connector` factory method implementation that required the `server` config property to be defined even though its value is ignored. Removing the validation when `config.options.connector` is defined fixes the problem. Ref: tediousjs#1540 Fixes: tediousjs#1541 Signed-off-by: Ruy Adorno <[email protected]>
Software versions
Additional Libraries Used and Versions
Particularly noticeable when using alongside the
@google-cloud/cloud-sql-connector
library that uses theconnector
factory method.Connection configuration
Notice the highlighted properties that should not be required, since a custom connector function is being used:
Problem description
When using the new custom
connector
factory method, theserver
andport
properties should not be required.Expected behavior
Config options defining only a
connector
factory method should be valid.Actual behavior
Error message/stack trace
Any other details that can be helpful
Please note that I'm the original contributor of that feature and will be happy to follow up with a fix for this problem 😊
The text was updated successfully, but these errors were encountered: