Comments (12)
Hi @anthonator, thanks for the report. I'd need a bit more info in order to debug this.
- What's the error that you're seeing in the logs, that gets reported as the screenshot above?
- Is your Sentry project configured as an Elixir project (on Sentry)?
- Do you have a way to reproduce this with a minimal Elixir app?
from sentry-elixir.
Thanks for getting back to me!
What's the error that you're seeing in the logs, that gets reported as the screenshot above?
2024-02-06 11:32:19.831** (exit) an exception was raised: | 2024-02-06 11:32:19.831 | ** (exit) an exception was raised: |
-- | -- | -- | --
2024-02-06 11:32:19.831 | ** (exit) an exception was raised: |
2024-02-06 11:32:19.831 ** (Ecto.ConstraintError) constraint error when attempting to insert struct: | | | 2024-02-06 11:32:19.831 | ** (Ecto.ConstraintError) constraint error when attempting to insert struct: |
| | 2024-02-06 11:32:19.831 | ** (Ecto.ConstraintError) constraint error when attempting to insert struct: |
2024-02-06 11:32:19.8312024-02-06 11:32:19.831 * "***_index" (unique_constraint)2024-02-06 11:32:19.8312024-02-06 11:32:19.831If you would like to stop this constraint violation from raising an2024-02-06 11:32:19.831exception and instead add it as an error to your changeset, please2024-02-06 11:32:19.831call `unique_constraint/3` on your changeset with the constraint2024-02-06 11:32:19.831`:name` as an option.2024-02-06 11:32:19.8312024-02-06 11:32:19.831The changeset defined the following constraints:2024-02-06 11:32:19.8312024-02-06 11:32:19.831 * "***_index" (unique_constraint)2024-02-06 11:32:19.8312024-02-06 11:32:19.831 (ecto 3.10.3) lib/ecto/repo/schema.ex:804: anonymous fn/4 in Ecto.Repo.Schema.constraints_to_errors/32024-02-06 11:32:19.831 (elixir 1.14.5) lib/enum.ex:1658: Enum."-map/2-lists^map/1-0-"/22024-02-06 11:32:19.831 (ecto 3.10.3) lib/ecto/repo/schema.ex:788: Ecto.Repo.Schema.constraints_to_errors/32024-02-06 11:32:19.831 (ecto 3.10.3) lib/ecto/repo/schema.ex:769: Ecto.Repo.Schema.apply/42024-02-06 11:32:19.831 (ecto 3.10.3) lib/ecto/repo/schema.ex:377: anonymous fn/15 in Ecto.Repo.Schema.do_insert/42024-02-06 11:32:19.831 (ecto 3.10.3) lib/ecto/multi.ex:844: Ecto.Multi.apply_operation/52024-02-06 11:32:19.831 (elixir 1.14.5) lib/enum.ex:2468: Enum."-reduce/3-lists^foldl/2-0-"/32024-02-06 11:32:19.831 (ecto 3.10.3) lib/ecto/multi.ex:818: anonymous fn/5 in Ecto.Multi.apply_operations/5 | | | 2024-02-06 11:32:19.831 | | | | | 2024-02-06 11:32:19.831 | * "***_index" (unique_constraint) | | | | 2024-02-06 11:32:19.831 | | | | | 2024-02-06 11:32:19.831 | If you would like to stop this constraint violation from raising an | | | | 2024-02-06 11:32:19.831 | exception and instead add it as an error to your changeset, please | | | | 2024-02-06 11:32:19.831 | call `unique_constraint/3` on your changeset with the constraint | | | | 2024-02-06 11:32:19.831 | `:name` as an option. | | | | 2024-02-06 11:32:19.831 | | | | | 2024-02-06 11:32:19.831 | The changeset defined the following constraints: | | | | 2024-02-06 11:32:19.831 | | | | | 2024-02-06 11:32:19.831 | * "***_index" (unique_constraint) | | | | 2024-02-06 11:32:19.831 | | | | | 2024-02-06 11:32:19.831 | (ecto 3.10.3) lib/ecto/repo/schema.ex:804: anonymous fn/4 in Ecto.Repo.Schema.constraints_to_errors/3 | | | | 2024-02-06 11:32:19.831 | (elixir 1.14.5) lib/enum.ex:1658: Enum."-map/2-lists^map/1-0-"/2 | | | | 2024-02-06 11:32:19.831 | (ecto 3.10.3) lib/ecto/repo/schema.ex:788: Ecto.Repo.Schema.constraints_to_errors/3 | | | | 2024-02-06 11:32:19.831 | (ecto 3.10.3) lib/ecto/repo/schema.ex:769: Ecto.Repo.Schema.apply/4 | | | | 2024-02-06 11:32:19.831 | (ecto 3.10.3) lib/ecto/repo/schema.ex:377: anonymous fn/15 in Ecto.Repo.Schema.do_insert/4 | | | | 2024-02-06 11:32:19.831 | (ecto 3.10.3) lib/ecto/multi.ex:844: Ecto.Multi.apply_operation/5 | | | | 2024-02-06 11:32:19.831 | (elixir 1.14.5) lib/enum.ex:2468: Enum."-reduce/3-lists^foldl/2-0-"/3 | | | | 2024-02-06 11:32:19.831 | (ecto 3.10.3) lib/ecto/multi.ex:818: anonymous fn/5 in Ecto.Multi.apply_operations/5
| | 2024-02-06 11:32:19.831 | |
| | 2024-02-06 11:32:19.831 | * "***_index" (unique_constraint) |
| | 2024-02-06 11:32:19.831 | |
| | 2024-02-06 11:32:19.831 | If you would like to stop this constraint violation from raising an |
| | 2024-02-06 11:32:19.831 | exception and instead add it as an error to your changeset, please |
| | 2024-02-06 11:32:19.831 | call `unique_constraint/3` on your changeset with the constraint |
| | 2024-02-06 11:32:19.831 | `:name` as an option. |
| | 2024-02-06 11:32:19.831 | |
| | 2024-02-06 11:32:19.831 | The changeset defined the following constraints: |
| | 2024-02-06 11:32:19.831 | |
| | 2024-02-06 11:32:19.831 | * "***_index" (unique_constraint) |
| | 2024-02-06 11:32:19.831 | |
| | 2024-02-06 11:32:19.831 | (ecto 3.10.3) lib/ecto/repo/schema.ex:804: anonymous fn/4 in Ecto.Repo.Schema.constraints_to_errors/3 |
| | 2024-02-06 11:32:19.831 | (elixir 1.14.5) lib/enum.ex:1658: Enum."-map/2-lists^map/1-0-"/2 |
| | 2024-02-06 11:32:19.831 | (ecto 3.10.3) lib/ecto/repo/schema.ex:788: Ecto.Repo.Schema.constraints_to_errors/3 |
| | 2024-02-06 11:32:19.831 | (ecto 3.10.3) lib/ecto/repo/schema.ex:769: Ecto.Repo.Schema.apply/4 |
| | 2024-02-06 11:32:19.831 | (ecto 3.10.3) lib/ecto/repo/schema.ex:377: anonymous fn/15 in Ecto.Repo.Schema.do_insert/4 |
| | 2024-02-06 11:32:19.831 | (ecto 3.10.3) lib/ecto/multi.ex:844: Ecto.Multi.apply_operation/5 |
| | 2024-02-06 11:32:19.831 | (elixir 1.14.5) lib/enum.ex:2468: Enum."-reduce/3-lists^foldl/2-0-"/3 |
| | 2024-02-06 11:32:19.831 | (ecto 3.10.3) lib/ecto/multi.ex:818: anonymous fn/5 in Ecto.Multi.apply_operations/5
Is your Sentry project configured as an Elixir project (on Sentry)?
No, it is not. Although this hasn't been an issue for projects using v8.
Do you have a way to reproduce this with a minimal Elixir app?
No, not currently
from sentry-elixir.
No, it is not. Although this hasn't been an issue for projects using v8.
If you change the project type to Elixir, does that change anything?
No, not currently
It's really hard for me to help debug this without any way to reproduce it 😢. All my tests point to errors showing up correctly, and we're on 10.1.0 at work and errors also show up correctly (also with Cowboy + Phoenix).
from sentry-elixir.
I recently upgraded another project to v10.1.0 and we're seeing the same issue. The Sentry project for this application is set as Elixir. Everything worked perfectly using v8.x.
If I have time I'll try to put together a minimal reproduction app.
Here are some additional details.
This is the first line of start/2
in our Application
module:
:logger.add_handler(:sentry_handler, Sentry.LoggerHandler, %{})
We also removed all use of Sentry.LoggerBackend
.
This is the first line of our endpont:
use Sentry.PlugCapture
The runtime.exs
looks like this.
if config_env() == :prod do
config :sentry,
dsn: System.get_env("SENTRY_DSN"),
enable_source_code_context: true,
environment_name: System.get_env("SENTRY_ENV"),
hackney_opts: [
ssl_options: [
cacertfile: :certifi.cacertfile(),
customize_hostname_check: [match_fun: :public_key.pkix_verify_hostname_match_fun(:https)],
verify: :verify_peer,
verify_fun: &:ssl_verify_hostname.verify_fun/3,
versions: [:"tlsv1.2", :"tlsv1.3"]
]
],
root_source_code_paths: [File.cwd!()]
end
This is how we create the release in our Dockerfile
:
RUN apk upgrade --no-cache \
&& mix deps.get \
&& mix compile \
&& mix app.config \
&& mix sentry.package_source_code \
&& mix release
Here's another example of what we're seeing in Sentry.
from sentry-elixir.
Just tried moving some Sentry config to config.exs
to see if there's a problem with the source mapping. Still seeing the same issue.
config.exs
config :sentry,
enable_source_code_context: true,
root_source_code_paths: [File.cwd!()]
runtime.exs
if config_env() == :prod do
config :sentry,
dsn: System.get_env("SENTRY_DSN"),
environment_name: System.get_env("SENTRY_ENV"),
hackney_opts: [
ssl_options: [
cacertfile: :certifi.cacertfile(),
customize_hostname_check: [match_fun: :public_key.pkix_verify_hostname_match_fun(:https)],
verify: :verify_peer,
verify_fun: &:ssl_verify_hostname.verify_fun/3,
versions: [:"tlsv1.2", :"tlsv1.3"]
]
]
end
When I run MIX_ENV=prod mix sentry.package_source_code
, I see:
Wrote 207 files in 139.6 kb to: _build/prod/lib/sentry/priv/sentry.map
When I make a release I can see sentry.map
in _build/prod/rel/myapp/lib/sentry-10.1.0/priv
.
from sentry-elixir.
When I call Sentry.Sources.get_source_code_map_from_persistent_term()
I don't see any maps for anything outside of my projects lib/
directory. So no dependencies. The errors I'm seeing that have this issue seem to be coming from dependencies.
Not sure if this is relevant but thought I'd share.
from sentry-elixir.
Tried removing deps/
from the exclude list with source_code_exclude_patterns: [~r/\/_build\//, ~r/\/priv\//, ~r/\/test\//]
.
I could see that more files were being added to the source map but still the same result.
from sentry-elixir.
This has nothing to do with whether dependencies are in the source map, no. What did that same error look like before the upgrade, do you have any examples?
from sentry-elixir.
I don't have a good 1-to-1 but here is another error that we see the issue with in 10.1.0. After downgrading to 8.1.0 this is what we see.
from sentry-elixir.
@anthonator did you have a chance to get a reproduceable example? Also, we did some changes in the :logger
handler, so might be worth trying out 10.4.0.
For now, I will close this as I have no way to reproduce this, but we can reopen if anything pops up.
from sentry-elixir.
I have not been able to get a reproducible example together, unfortunately. However, this is still an issue for us. Only thing we’ve been able to do is downgrade to 8.x. All versions 9+ have exhibited this behavior.
Thanks for helping where you could on this.
from sentry-elixir.
If you shared how the whole error looks like on Sentry I might be able to help. Feel free to reach out at [email protected] if that contains private data, but with the current information I cannot reproduce this sadly.
from sentry-elixir.
Related Issues (20)
- `PlugContext`: protocol not implemented for struct HOT 2
- Default `:max_breadcrumbs` config not picked up after updating to v10.1 HOT 14
- Request for a new release HOT 1
- Events missing request body when using Pheonix integration HOT 4
- [elixir] Support for "Metrics" HOT 3
- App output obscured by continual deprecation warning "the log level :warn is deprecated, use :warning instead" HOT 1
- Support for "Cron Monitors" HOT 2
- Clarify `:included_environments` deprecated option HOT 4
- Depending on plug instead of plug_cowboy HOT 1
- W3C Trace Context support
- Flaky test suite after migration from 9.1.0 to 10.2.0 HOT 4
- Output of `mix sentry.send_test_event` has no environment name HOT 10
- Could not fetch application environment `:sender_pool_size` HOT 1
- Impossible to attach arbitrary stacktrace to log message when using `:logger` handler HOT 4
- Improve rendering of some terms in JSON HOT 1
- Implement rate limiting for logger handler
- Cron Monitor integration for Oban HOT 1
- Switch from Hackney to Finch as the default HTTP client HOT 1
- It's unclear if LoggerHandler implement overload protection HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sentry-elixir.