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

Retain deployId query param from PUT request #86

Merged
merged 4 commits into from
Sep 13, 2024

Conversation

KiKoS0
Copy link
Collaborator

@KiKoS0 KiKoS0 commented Sep 12, 2024

Summary

Syncing from the cloud platform by giving it an ngrok URL used to fail before this change and should work as expected with this.

image

  • Pass the deployId query parameter from the PUT request to the POST Sync call.
  • Mock okhttp3 client to test the behavior.
  • Fixes an always truthy condition for getting the request's origin which caused the port to show up in the platform UI and causes resync issues:
    image

I followed this doc for mocking the HTTP client: https://github.com/square/okhttp/tree/master/mockwebserver

Checklist

  • Update documentation
  • Added unit/integration tests

Related

@KiKoS0 KiKoS0 requested a review from albertchae September 12, 2024 22:50
@KiKoS0 KiKoS0 self-assigned this Sep 12, 2024
Copy link

linear bot commented Sep 12, 2024

@KiKoS0 KiKoS0 force-pushed the riadh/inn-3561-pass-deploy-id-query-param branch from fe03e27 to 571c660 Compare September 12, 2024 23:02
@KiKoS0 KiKoS0 marked this pull request as ready for review September 12, 2024 23:08
mockWebServer.shutdown();
}

private void assertThatPayloadDoesNotContainDeployId(RecordedRequest recordedRequest) throws Exception {
Copy link
Collaborator Author

@KiKoS0 KiKoS0 Sep 12, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://github.com/inngest/inngest/blob/main/docs/SDK_SPEC.md#432-syncing

If a deployId query string parameter is set on the sync request received by the SDK, the SDK MUST set the same key and value on the query string of the POST request to Inngest and MUST NOT include the deployId in the URL included in the Sync’s payload. The deployId is used to attribute various parts of a sync’s handshake with each other.

I could add a comment linking the spec doc but i'm not sure if it's a good idea.

@KiKoS0 KiKoS0 force-pushed the riadh/inn-3337-support-introspect branch from 1822df5 to 7da679e Compare September 13, 2024 00:54
Base automatically changed from riadh/inn-3337-support-introspect to main September 13, 2024 01:07
An error occurred while trying to automatically change base from riadh/inn-3337-support-introspect to main September 13, 2024 01:07
@KiKoS0 KiKoS0 force-pushed the riadh/inn-3561-pass-deploy-id-query-param branch from 571c660 to 59a8147 Compare September 13, 2024 01:08
Copy link
Collaborator

@albertchae albertchae left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice, especially the work to set up the test with the mock server

@Import(SyncInngestConfiguration.class)
@WebMvcTest(DemoController.class)
@Nested
@EnabledIfSystemProperty(named = "test-group", matches = "unit-test")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I forgot to ask this on another PR, but what exactly does this do? Run it only in make test or make itest?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It runs only on make test, the property is set in:

systemProperty("test-group", "unit-test")

I'm open to better ways to accomplish this though.

@KiKoS0 KiKoS0 merged commit 37aabd7 into main Sep 13, 2024
9 checks passed
@KiKoS0 KiKoS0 deleted the riadh/inn-3561-pass-deploy-id-query-param branch September 13, 2024 01:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants