At https://github.com/n8n-io/n8n/pull/8213 we introduced Redis hashes
for workflow ownership and manual webhooks...
- to remove clutter from multiple related keys at the top level,
- to improve performance by preventing serializing-deserializing, and
- to guarantee atomicity during concurrent updates in multi-main setup.
Workflow activation errors can also benefit from this. Added test
coverage as well.
To test manually, create a workflow with a trigger with an invalid
credential, edit the workflow's `active` column to `true`, and restart.
The activation error should show as a red triangle on canvas and in the
workflow list.
## Summary
Postgres columns can be
- [generated as
identity](https://www.postgresqltutorial.com/postgresql-tutorial/postgresql-identity-column/)
- [generated by a custom
expression](https://www.postgresql.org/docs/current/ddl-generated-columns.html)
In these 2 cases, the column is not required when inserting a new row.
This PR makes sure these types of column are not marked required in n8n.
### How to test
1. Create a Postgres table with all types of generated columns:
for version >= 10
```sql
CREATE TABLE "public"."test_table" (
"id" int8 NOT NULL DEFAULT nextval('test_table_id_seq'::regclass),
"identity_id" bigint GENERATED ALWAYS AS IDENTITY,
"id_plus" numeric GENERATED ALWAYS AS (id + 5) STORED,
"title" varchar NOT NULL,
"created_at" timestamp DEFAULT now(),
PRIMARY KEY ("id")
)
```
Before 10 you have to use serial or bigserial types:
```sql
CREATE TABLE distributors (
did serial not null primary key,
name varchar(40) NOT NULL CHECK (name <> '')
);
```
2. Add a postgres node to canvas and try to insert data without the
generated columns
3. Should successfully insert
More info in Linear/Github issue ⬇️
## Related tickets and issues
- fixes#7084
-
https://linear.app/n8n/issue/NODE-816/rmc-not-all-id-fields-should-be-required
-
https://linear.app/n8n/issue/NODE-681/postgres-cant-map-automatically-if-database-requires-a-field
## Review / Merge checklist
- [ ] PR title and summary are descriptive. **Remember, the title
automatically goes into the changelog. Use `(no-changelog)` otherwise.**
([conventions](https://github.com/n8n-io/n8n/blob/master/.github/pull_request_title_conventions.md))
- [ ] [Docs updated](https://github.com/n8n-io/n8n-docs) or follow-up
ticket created.
- [ ] Tests included.
> A bug is not considered fixed, unless a test is added to prevent it
from happening again.
> A feature is not complete without tests.
---------
Co-authored-by: Michael Kret <michael.k@radency.com>
## Summary
- Moved out canvas loading handling to canvas store
- Tag editable routes via meta to remove router dependency from generic
helpers
- Replace all occurrences of `genericHelpers` mixin with composable and
audit usage
- Moved out `isRedirectSafe` and `getRedirectQueryParameter` out of
genericHelpers to remove dependency on router
Removing the router dependency is important, because `useRouter` and
`useRoute` compostables are only available if called from component
instance. So if composable is nested within another composable, we
wouldn't be able to use these. In this case we'd always need to inject
the router and pass it through several composables. That's why I moved
the `readonly` logic to router meta and `isRedirectSafe` and
`getRedirectQueryParameter` out as they were only used in a single
component.
---------
Signed-off-by: Oleg Ivaniv <me@olegivaniv.com>
Story: https://linear.app/n8n/issue/PAY-1188
- Implement Redis hashes on the caching service, based on Micha's work
in #7747, adapted from `node-cache-manager-ioredis-yet`. Optimize
workflow ownership lookups and manual webhook lookups with Redis hashes.
- Simplify the caching service by removing all currently unused methods
and options: `enable`, `disable`, `getCache`, `keys`, `keyValues`,
`refreshFunctionEach`, `refreshFunctionMany`, `refreshTtl`, etc.
- Remove the flag `N8N_CACHE_ENABLED`. Currently some features on
`master` are broken with caching disabled, and test webhooks now rely
entirely on caching, for multi-main setup support. We originally
introduced this flag to protect against excessive memory usage, but
total cache usage is low enough that we decided to drop this setting.
Apparently this flag was also never documented.
- Overall caching service refactor: use generics, reduce branching, add
discriminants for cache kinds for better type safety, type caching
events, improve readability, remove outdated docs, etc. Also refactor
and expand caching service tests.
Follow-up to: https://github.com/n8n-io/n8n/pull/8176
---------
Co-authored-by: Michael Auerswald <michael.auerswald@gmail.com>
- Add extra params to 'User closed cred setup' event
- Fire 'User closed cred setup' only when template has creds
- Skip cred setup page if template has no creds required
- Fire 'User inserted workflow template' also in cred setup
In #8088 template ID was added to workflow metadata, but it was missing
from workflows that were created using the template credential setup.
This fixes that.
## Summary
Required as part of NodeView refactoring:
- Migrates `pinData` mixin to `usePinnedData` composable.
- Adds `useActiveNode` and `useNodeType` composables
## Related tickets and issues
https://linear.app/n8n/issue/N8N-6355/pindata
## Review / Merge checklist
- [x] PR title and summary are descriptive. **Remember, the title
automatically goes into the changelog. Use `(no-changelog)` otherwise.**
([conventions](https://github.com/n8n-io/n8n/blob/master/.github/pull_request_title_conventions.md))
- [x] [Docs updated](https://github.com/n8n-io/n8n-docs) or follow-up
ticket created.
- [x] Tests included.
> A bug is not considered fixed, unless a test is added to prevent it
from happening again.
> A feature is not complete without tests.
## Summary
We stop showing the fake-door templates when the user clicks on "notify
me when it's is available" (this notification is shown when the user
clicks on "use template"). This PR changes this behavior and stop
showing the fakedoor templates when the user clicks on "use template".
Additionally, also increases the "template coming soon" notification
time from 4.5 seconds to 10 seconds.
<img width="395" alt="image"
src="https://github.com/n8n-io/n8n/assets/16496553/2e643b1f-dd52-46f0-951f-29e630241f73">
## Summary
> Describe what the PR does and how to test. Photos and videos are
recommended.
Every time the `MainHeader` component is created, we register a new
handler for the "push" messages. Unfortunately this becomes an issue if
you go multiple times to a page that renders the `MainHeader`, e.g
`/workflow/:id`, without refreshing the page; because all handlers will
be called, causing behavior duplication.
I added the possibility of passing an ID, and made impossible to have
multiple handlers with the same ID However, it does not seems to be
needed to support an array of handlers in the pushConnection store. If
that is the case:
1. We might want to have only one handler for the push connections at
all times, which would be a much simpler approach.
2. Register the handler on app.mount instead.
The issue seems to have been introduced
[here](https://github.com/n8n-io/n8n/pull/7763/files#diff-f5dae80a64b9951bb6691f1b9d439423cf84fa0cc9601b3f2c00904f3135e8deR48)
Before the change:
https://www.loom.com/share/85cf8ef896254d848a13a6c6438daa47
With the change:
https://www.loom.com/share/f5c4ffac421d46cc8e389364e1c357d3
## Related tickets and issues
https://linear.app/n8n/issue/ADO-1596/bug-items-count-display-in-running-workflow
## Review / Merge checklist
- [x] PR title and summary are descriptive. **Remember, the title
automatically goes into the changelog. Use `(no-changelog)` otherwise.**
([conventions](https://github.com/n8n-io/n8n/blob/master/.github/pull_request_title_conventions.md))
- [ ] [Docs updated](https://github.com/n8n-io/n8n-docs) or follow-up
ticket created.
- [ ] Tests included.
> A bug is not considered fixed, unless a test is added to prevent it
from happening again.
> A feature is not complete without tests.
In a multi-main setup, we have the following issue. The user's client
connects to main A and runs a test webhook, so main A starts listening
for a webhook call. A third-party service sends a request to the test
webhook URL. The request is forwarded by the load balancer to main B,
who is not listening for this webhook call. Therefore, the webhook call
is unhandled.
To start addressing this, cache test webhook registrations, using Redis
for queue mode and in-memory for regular mode. When the third-party
service sends a request to the test webhook URL, the request is
forwarded by the load balancer to main B, who fetches test webhooks from
the cache and, if it finds a match, executes the test webhook. This
should be transparent - test webhook behavior should remain the same as
so far.
Notes:
- Test webhook timeouts are not cached. A timeout is only relevant to
the process it was created in, so another process retrieving from Redis
a "foreign" timeout will be unable to act on it. A timeout also has
circular references, so `cache-manager-ioredis-yet` is unable to
serialize it.
- In a single-main scenario, the timeout remains in the single process
and is cleared on test webhook expiration, successful execution, and
manual cancellation - all as usual.
- In a multi-main scenario, we will need to have the process who
received the webhook call send a message to the process who created the
webhook directing this originating process to clear the timeout. This
will likely be implemented via execution lifecycle hooks and Redis
channel messages checking session ID. This implementation is out of
scope for this PR and will come next.
- Additional data in test webhooks is not cached. From what I can tell,
additional data is not needed for test webhooks to be executed.
Additional data also has circular references, so
`cache-manager-ioredis-yet` is unable to serialize it.
Follow-up to: #8155
Github issue / Community forum post (link here to close automatically):
---------
Co-authored-by: Giulio Andreini <andreini@netseven.it>
Co-authored-by: Marcus <marcus@n8n.io>
The ai_beta branch had deleted.
## Summary
> Just replaced the branch name.
## Related tickets and issues
> No.
## Review / Merge checklist
- [x] PR title and summary are descriptive. **Remember, the title
automatically goes into the changelog. Use `(no-changelog)` otherwise.**
([conventions](https://github.com/n8n-io/n8n/blob/master/.github/pull_request_title_conventions.md))
- [ ] [Docs updated](https://github.com/n8n-io/n8n-docs) or follow-up
ticket created.
- [ ] Tests included.
> A bug is not considered fixed, unless a test is added to prevent it
from happening again.
> A feature is not complete without tests.