Skip to content
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

Unable to Upload Source Maps Despite Following Documentation with Remix #2126

Closed
ishaank15 opened this issue Aug 21, 2024 · 10 comments
Closed

Comments

@ishaank15
Copy link

ishaank15 commented Aug 21, 2024

Description:

We are encountering issues with uploading our source maps to Sentry, despite following the official documentation and ensuring that our setup is correct. We are using the sentry-cli tool and have integrated it into our build and deployment pipeline. However, we continue to face errors related to Debug IDs and the source maps not being correctly processed.

Steps Taken:
Source Maps Injection:
We are using the following command to inject Debug IDs and upload source maps:

sentry-cli sourcemaps inject --org <org-name> --project <project-name> ./public/**/*.map && sentry-cli sourcemaps upload --org <org-name> --project <project-name> ./public/**/*.map

This command is supposed to inject Debug IDs and upload the source maps for the project files within the public folder, including subdirectories.

Deployment:
We ensure that the same build used to upload source maps is deployed to production without any modifications.

Result:
Despite following the documentation, we are encountering the following errors:

"Nothing to upload, all files are on the server."
"This event doesn't contain any Debug IDs yet."
"A project ID or slug is required (provide with --project)"
"Failed to process uploaded files: uploading a bundle without Debug IDs or release is prohibited."
We also receive messages indicating that "Some source files don't have Debug IDs" or that we have already uploaded artifacts, yet the files deployed don't contain Debug IDs.

Expected Behavior:
The source maps should be correctly uploaded to Sentry and linked to our production errors.
Debug IDs should be properly injected into the JavaScript files and matched with the uploaded source maps.
Actual Behavior:
Source maps either fail to upload, or we receive errors related to missing Debug IDs or mismatches between the uploaded files and the deployed ones.
Sentry is unable to map the errors to the original source files.
Additional Information:
We are using sentry-cli version: [Your CLI Version]
The issue occurs consistently across multiple builds and deployments.
We have verified that the source maps are available in the deployment and are being referenced correctly in our JavaScript bundles.

Request:
Please assist us in troubleshooting this issue. We would like guidance on:

Ensuring that Debug IDs are correctly injected and uploaded.
Properly associating the uploaded source maps with our production events.
Any additional steps or configurations we might have missed that could be causing the mismatch.
Thank you in advance for your assistance!

@haseeb-numu
Copy link

In my case, source map files were uploaded to Sentry, but errors were not captured because sentry-cli inject command added some code along with debug IDs to all files in the './dist' folder. I then migrated the Sentry SDK from version 7 to 8, and it worked for me. However, it should have worked with version 7, as migrating to version 8 wasn't easy due to the major changes involved.

@szokeasaurusrex
Copy link
Member

Hi @ishaank15, we are currently doing a company-wide HackWeek. We will get back to you early next week.

In the meantime, it would be helpful if you could describe the exact steps you are taking, and the exact errors (full logs if possible) you are receiving on each step. If you can additionally provide a reproduction, that would help us greatly.

@szokeasaurusrex
Copy link
Member

szokeasaurusrex commented Aug 28, 2024

Hey @ishaank15, I was able to look into your issue a bit more today. In order to help you I need two pieces of information:

  • What version of the Sentry JavaScript SDK are you using?

    • You need at least version 7.47.0 to use sourcemaps.
  • Are you using SaaS (sentry.io) or self-hosted?

    • If you are using SaaS, please share a link to a Sentry issue which you think should have source maps, but does not. This will greatly help us with debugging your problem.

I will be happy to assist further once you have provided this information.

@ishaank15
Copy link
Author

Hey @szokeasaurusrex
I am using the following config

  • Sentry JS SDK:
"@sentry/cli": "^2.33.1",
    "@sentry/integrations": "^7.114.0",
    "@sentry/remix": "^8.26.0",

Using SaaS

  1. Sentry Error 1: The logs and traces are visible
  2. Sentry Error 2: the logs for same release, same artifactsa re not available.

@szokeasaurusrex
Copy link
Member

szokeasaurusrex commented Aug 29, 2024

Hi @ishaank15, I am not seeing any Debug IDs in the event either of the event payloads you linked.

The missing Debug IDs can explain the behavior you are observing. In the first error, stack traces are likely visible because the source map could be located based on the release and file name; in the second error, this matching appears to have failed. This might be because the path is different on the server than in the uploaded source bundle.

Most likely, the reason why the Debug IDs are missing from the event is because you deployed the non-injected code. For sourcemaps to work properly, you need to run sourcemaps inject before deploying your code to the server. The deployed code must have the Debug IDs injected, so that the event payloads all contain the Debug ID, enabling each event to be matched with the corresponding sourcemap.

My recommendation to solve your problem would be to re-install the Remix SDK with the Sentry wizard. The Sentry wizard will automatically configure your build process to upload sourcemaps to Sentry when building your project. That way, you do not have to manually inject or upload sourcemaps with Sentry CLI.

Please let me know whether that fixes your problem. If you still are having problems, I am happy to help.

@ishaank15
Copy link
Author

I have trie both the ways, with sentry-cli and remix sdk, but got unlucky with them. It's surprising how sometimes it detects say x files and then next time rerunning it detects only half of them. Let me know if there is a way to connect and close this. I am eager to know the cause.

@szokeasaurusrex
Copy link
Member

I have trie both the ways, with sentry-cli and remix sdk

Have you followed the process described here by running the following?

npx @sentry/wizard@latest -i remix

@ishaank15
Copy link
Author

Yes, I have tried running
npx @sentry/wizard@latest -i remix

Here's the output

Image

@szokeasaurusrex
Copy link
Member

Looks like npx @sentry/wizard@latest -i remix is not doing anything because you already have Sentry set up in the project. When you initially added Sentry to your project, did you add it with the npx @sentry/wizard@latest -i remix command or a different method? If you added it via a different method, I would recommend removing all the Sentry setup code and reinstalling Sentry with the npx @sentry/wizard@latest -i remix command.

@getsantry
Copy link

getsantry bot commented Sep 21, 2024

This issue has gone three weeks without activity. In another week, I will close it.

But! If you comment or otherwise update it, I will reset the clock, and if you remove the label Waiting for: Community, I will leave it alone ... forever!


"A weed is but an unloved flower." ― Ella Wheeler Wilcox 🥀

@getsantry getsantry bot added the Stale label Sep 21, 2024
@getsantry getsantry bot closed this as not planned Won't fix, can't repro, duplicate, stale Sep 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

No branches or pull requests

3 participants