Skip to content

Conversation

@Vinnl
Copy link
Collaborator

@Vinnl Vinnl commented Oct 16, 2025

References:

Jira: MNTOR-5071
Figma:

Description

I could not reproduce the exact issue that we're seeing in our logs, but I could trigger the code path that imports next/headers locally, and that shouldn't be possible.

Possibly the error in the logs are because next isn't installed for some reason, or we're using a version of Node that doesn't support importing from next/headers rather than just next?

How to test

Follow the readme instructions on pubsub, but for the curl request, find a user's primary_sha1, take the first six characters and use that as the hashPrefix, and the rest as a hashSuffix.

Also, after you do this once, be sure to DELETE FROM "email_notifications"; if you want to try again.

Checklist (Definition of Done)

  • Localization strings (if needed) have been added.
  • Commits in this PR are minimal and have descriptive commit messages.
  • I've added or updated the relevant sections in readme and/or code comments
  • I've added a unit test to test for potential regressions of this bug.
  • If this PR implements a feature flag or experimentation, I've checked that it still works with the flag both on, and with the flag off.
  • If this PR implements a feature flag or experimentation, the Ship Behind Feature Flag status in Jira has been set
  • Product Owner accepted the User Story (demo of functionality completed) or waived the privilege.
  • All acceptance criteria are met.
  • Jira ticket has been updated (if needed) to match changes made during the development process.
  • Jira ticket has been updated (if needed) with suggestions for QA when this PR is deployed to stage.

@Vinnl Vinnl requested review from kschelonka and mansaj October 16, 2025 12:09
@Vinnl Vinnl self-assigned this Oct 16, 2025
@Vinnl Vinnl added the Review: XS Code review time: up to 30min label Oct 16, 2025
@Vinnl Vinnl mentioned this pull request Oct 16, 2025
10 tasks
@Vinnl Vinnl force-pushed the MNTOR-5071-headers-in-cron branch from 73ac563 to d130699 Compare October 16, 2025 18:01
@Vinnl Vinnl force-pushed the MNTOR-5071-headers-in-cron branch from d130699 to 0d62968 Compare October 16, 2025 18:03
@kschelonka
Copy link
Collaborator

kschelonka commented Nov 3, 2025

You correctly identified here that the default value of E2E_TEST_ENV=local was leaking into prod (it wasn't overridden by prod config). I'm concerned about how much the runtime and config is entangled with the business logic, and I know it's caused incidents in the past. I think rather than adding more, we should try to address the issue of unclear domain separation/boundaries and hidden dependencies.

@Vinnl
Copy link
Collaborator Author

Vinnl commented Nov 4, 2025

@kschelonka As you know, I agree :) That said, I think with that in mind too it can be helpful to merge this - when we get around to untangling it, the checks for NEXT_RUNTIME will help us identify which code paths go into the Next.js codebase and can be left out of the cron job/PubSub codebase. WDYT?

@kschelonka
Copy link
Collaborator

Reading up on this so I can give a more educated reply

@kschelonka
Copy link
Collaborator

kschelonka commented Nov 6, 2025

Ok, I've done some more reading and thinking. I'm cautious with "magical" stuff like next because I want to make sure I understand what's going on under the hood...

getExperiments as written before had a hidden dependency on the next environment due to importing and invoking loadNextHeaders. I'm resistant to adding more layers of state-dependent logic, when the issue could be solved more simply by accepting actual headers in getExperiments function args (or using DI similarly)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Review: XS Code review time: up to 30min

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants