Commit Graph

50 Commits

Author SHA1 Message Date
Thales Macedo Garitezi
b71212b022 refactor: apply review comments 2024-06-17 09:40:33 -03:00
Thales Macedo Garitezi
6e702cd16c fix(postgres): fix usage by authn/authz modules when prepared statements are disabled
Fixes https://emqx.atlassian.net/browse/EMQX-12550
2024-06-14 12:19:46 -03:00
Thales Macedo Garitezi
fd5e844cc1 fix(postgres): correctly handle batch queries with disabled prepared statements
Fixes https://emqx.atlassian.net/browse/EMQX-12549
2024-06-14 11:10:21 -03:00
Kjell Winblad
9d22089104
Merge pull request #13173 from kjellwinblad/kjell/pgsql_timestamp_encode_etc/EEC-1036
fix(pgsql connector): handle prepared statement already exists
2024-06-11 10:53:30 +02:00
Kjell Winblad
c13631102e fix(PgSQL connector): typo in function name 2024-06-07 19:40:18 +02:00
Kjell Winblad
e63dcc84b0 fix: unused variable and better error message 2024-06-07 12:20:42 +02:00
Kjell Winblad
2956e849eb fix(pgsql connector): better msg when failing to remove statement 2024-06-05 16:58:14 +02:00
Kjell Winblad
336089f8a7 fix: bug found by dialyzer and make test case cleaner 2024-06-05 15:53:02 +02:00
Thales Macedo Garitezi
c07bc68e6f feat(postgres): add disable_prepared_statements option
Fixes https://emqx.atlassian.net/browse/EMQX-12496

Some Postgres connections, such ones made to [PGBouncer](https://www.pgbouncer.org/) or
[Supabase in Transaction Mode](https://supabase.com/), do not support some session
features like prepared statements.
2024-06-04 10:11:25 -03:00
Kjell Winblad
572ca6433e fix(pgsql connector): improvements due to suggestions from @thalesmg
Co-authored-by: Thales Macedo Garitezi <thalesmg@gmail.com>
2024-06-04 10:11:45 +02:00
Kjell Winblad
f2ccfff803 fix(pgsql connector): handle prepared statement already exists
In a user's log file it was found that that the pgsql driver can end up
in a situation where the prepared statement for a channel/action is not
properly removed before a channel with the same name as the prepared
statement is added to the connector. This commit handles this by
attempting to remove the old prepared statement if one already exists
when adding channel.

Related issue:
https://emqx.atlassian.net/browse/EEC-1036
2024-06-03 16:14:26 +02:00
Thales Macedo Garitezi
f690db9849 fix(postgres): reduce log spamming when connection goes down
Fixes https://emqx.atlassian.net/browse/EMQX-12334

See also: https://github.com/emqx/epgsql/pull/10
2024-05-10 12:15:01 -03:00
Kjell Winblad
5bfe31b691 fix: issues found during PR review (thanks @thalesmg and @zmstone)
* Simpler handling of true and false in best effort JSON formatter
* inet:ntoa/1 to format IP addresses
* Made a record for lazy formatted trace values and formatter to improve
  maintainability
* Added callback to format return value from connector
  * Extended test case to check that the format return value callback
    works
* Added handling of "lazy" trace entry data to the text formatter. Do we
  need to handle this data in the normal log formatters as well?
2024-05-03 15:04:57 +02:00
Kjell Winblad
ea7633c484 fix: rule trace formatting, republish and console stop after rendering
* Better rule trace formatting for many trace entries
* The republish and console actions have got working stop after
  rendering functionality
2024-05-03 15:02:36 +02:00
Kjell Winblad
b02ed4e6ec feat: add stop after render and after render trace to pgsql action 2024-04-25 11:51:46 +02:00
Ivan Dyachkov
db9efb9317 chore: bump apps versions 2024-03-28 10:19:09 +01:00
Kjell Winblad
4bfc51c052 refactor(emqx_connector_info): improve documentation and type specs 2024-03-21 16:08:31 +01:00
Zaiming (Stone) Shi
46877e979b chore: update copyright-year 2024-02-23 08:21:06 +01:00
Thales Macedo Garitezi
d469f4158e chore: bump app vsns 2024-02-20 16:53:57 -03:00
Zaiming (Stone) Shi
f57f617ba3 refactor(schema): ensure roots/0 and namespace/0 for all schema modules 2024-02-16 11:35:32 +01:00
Thales Macedo Garitezi
3207f0ea80 fix(machine_boot): inject connector/bridge apps as dependencies to emqx_connector app
Fixes https://emqx.atlassian.net/browse/EMQX-11771

For the same reasons as we inject `emqx_bridge_*` applications as dependencies to
`emqx_bridge` when starting the node.  Already configured connectors are started when
`emqx_connector` application starts, and may lead to crashes and noise in the logs.  One
example is to configure a mongodb bridge and restart the node.
2024-01-22 11:13:34 -03:00
JimMoen
5e100f52b8
style: erlfmt all rebar.config files and bin/nodetool 2023-12-29 09:08:03 +08:00
Thales Macedo Garitezi
cf9331a95f Merge branch 'release-54' into sync-r54-m-20231218 2023-12-18 17:21:08 -03:00
Zaiming (Stone) Shi
516b1dc346 chore(postgres): upgrade lib epgsql from 4.7.0.1 to 4.7.1.1
epgsql 4.7.1.1 has otp 26 compatibility fixed
2023-12-14 22:20:01 +01:00
Thales Macedo Garitezi
a5d848515b fix: project sub-fields in action/connector resource_opts for some bridges
Fixes https://emqx.atlassian.net/browse/EMQX-11589
2023-12-14 12:09:32 -03:00
Thales Macedo Garitezi
f7adaa8911 fix(postgres_schema): fix usages of resource_opts in connector and action schemas
Fixes https://emqx.atlassian.net/browse/EMQX-11569
2023-12-11 15:03:20 -03:00
Zaiming (Stone) Shi
423b586c56 fix(dialyzer): fix some dialyzer issues found on otp 26 2023-12-06 20:32:49 +01:00
Thales Macedo Garitezi
17b6143c30
Merge pull request #12102 from thalesmg/nit-postgres-log-m-20231205
chore(postgres): prettify logged errors
2023-12-06 10:10:02 -03:00
Thales Macedo Garitezi
e03b8fd80e chore(postgres): prettify logged errors
Fixes https://emqx.atlassian.net/browse/EMQX-11490
2023-12-05 15:55:18 -03:00
Thales Macedo Garitezi
7a1288e802 fix(bridge_postgres): add resource_opts to connector schema 2023-12-04 10:02:05 -03:00
Ivan Dyachkov
9fd2fa95a8 chore: bump apps versions 2023-11-30 20:01:12 +01:00
Zaiming (Stone) Shi
6c85e62d26 fix(schema): add namespaces 2023-11-28 12:07:42 +01:00
Stefan Strigler
048f4724a9 feat(emqx_connector): add field 'actions' in API response
Also unify schemas, use emqx_connector_schema for the generic parts.
2023-11-27 16:09:17 +01:00
Kjell Winblad
c85004b7ef chore: remove obsolete TODO 2023-11-24 21:22:27 +01:00
Kjell Winblad
66945dcc5c fix: address more comments from @thalesmg 2023-11-24 20:31:29 +01:00
Kjell Winblad
f070d80b1a fix: swagger examples for PostgreSQL, Matrix and Timescale 2023-11-24 18:50:52 +01:00
Kjell Winblad
e920160805 fix: add enable and description fields to PostgreSQL connector 2023-11-24 17:33:39 +01:00
Kjell Winblad
3dca83c854 fix: all missing descriptions 2023-11-24 17:33:39 +01:00
Kjell Winblad
c5e281b84b fix: emqx_auth_postgresql test suites 2023-11-24 17:33:39 +01:00
Kjell Winblad
6ef9c6fe4a fix: ops 2023-11-24 17:33:39 +01:00
Kjell Winblad
64c015cf6f fix: unify the schema modules in emqx_bridge_pgsql 2023-11-24 17:33:39 +01:00
Kjell Winblad
2e3028a8f8 fix(emqx_postgresql): fix lifecycle test 2023-11-24 17:33:39 +01:00
Kjell Winblad
dbe73c70b1 fix: dialyzer problem 2023-11-24 17:33:38 +01:00
Kjell Winblad
d5b62eead0 feat: split pgsql, matrix and timescale into connector action
This commit splits the bridges pgsql, matrix and timescale into
connector and action.

Fixes:
https://emqx.atlassian.net/browse/EMQX-11155
2023-11-24 17:33:35 +01:00
Andrew Mayorov
d1c3b1c659
fix(bridges): handle secrets more consistently
Co-authored-by: Thales Macedo Garitezi <thalesmg@gmail.com>
2023-11-14 16:05:54 +07:00
Andrew Mayorov
4385b2f020
feat(pgsql): accept wrapped secrets as passwords
That are coming from `emqx_schema_secret`. Also adapt pgsql-related
connectors.
2023-11-14 16:05:23 +07:00
Andrew Mayorov
b5b6c3f8cc
fix(tpl): ensure full backward compat in basic connectors 2023-11-02 20:13:32 +07:00
Andrew Mayorov
8e4585d64f
chore: move template modules to emqx_utils
Even though most of the time these modules will be used by
connectors, there are exceptions (namely, `emqx_rule_engine`).
Besides, they are general enough to land there, more so given
that `emqx_placeholder` is already there.
2023-11-02 17:11:12 +07:00
Andrew Mayorov
35902dc72d
feat(tpl): switch basic connectors to emqx_connector_template
Also avoid `filename:join/2` in HTTP connector since it's both OS specific
and an overkill.
2023-11-02 17:11:09 +07:00
Ilya Averyanov
4f14e8df22 chore(source dir): split out postgresql connector 2023-10-13 16:58:57 +03:00