ash-project / ash-project/ash

PubSub DSL module option doesn't expand aliases.

Open
#1,202 2 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
Elixir
Stars
2.5k
Forks
426
Avg merge
23h 26m
Merged PRs (30d)
46

Description

**Describe the bug**
Specifying an alias as the module for a pub sub fails with:

```
** (UndefinedFunctionError) function PubSub.broadcast/3 is undefined (module PubSub is not available). Did you mean:

* MyApp.PubSub.broadcast/3
```

**To Reproduce**
```elixir
alias MyApp.PubSub

pub_sub do
module PubSub
end
```

**Expected behavior**
It publishes pubsub messages.

**Runtime**
- Elixir version: `1.16.3`
- Erlang version: `27.0`
- OS: `Darwin Eeloo 23.5.0 Darwin Kernel Version 23.5.0: Wed May 1 20:12:58 PDT 2024; root:xnu-10063.121.3~5/RELEASE_ARM64_T6000 arm64`
- Ash version: `3.0.2`
- any related extension versions

**Additional context**
Add any other context about the problem here.

Contributor guide

Open the contributing guide

Research direction

Start by tracing the pub_sub DSL's module option using the alias-based reproduction in the issue, then check how the configured module is resolved before broadcasting. Done means the aliased MyApp.PubSub module publishes pubsub messages without the UndefinedFunctionError.

Written by the indexing model from the issue text.

Assessment

Tech stack
elixir
Domain
backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.