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

feat(testing): Add test projects for Cloudflare Workers. Vercel Remix + NextJS, Deno, and Bun #252

Merged
merged 9 commits into from
Oct 12, 2023

Conversation

max-stytch
Copy link
Contributor

@max-stytch max-stytch commented Oct 2, 2023

Adds a new test-runtimes directory with setup instructions for various runtimes the Node SDK can be used in. Hopefully this will make it easier to test iterations of the Node SDK in different runtimes. Runtimes are not plug&play, developers will need to install various things, make accounts with providers, etc.

The following runtimes are tested:

  • cloudflare-workers
  • remix
  • nextjs serverless
  • nextjs edge
  • deno
  • bun

@max-stytch max-stytch changed the title feat(testing): Add test projects for Cloudflare Workers and Remix feat(testing): Add test projects for Cloudflare Workers. Vercel Remix + NextJS, Deno, and Bun Oct 4, 2023
@max-stytch max-stytch temporarily deployed to integration_tests October 4, 2023 20:53 — with GitHub Actions Inactive
@max-stytch max-stytch temporarily deployed to integration_tests October 4, 2023 20:53 — with GitHub Actions Inactive
# or
pnpm dev
# or
bun dev
Copy link
Contributor

@chris-stytch chris-stytch Oct 4, 2023

Choose a reason for hiding this comment

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

Typo? Not sure if you wanted bun here in Next.js

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is the NextJS OOTB readme - they support bun too

Comment on lines +8 to +9
project_id: "project-live-c60c0abe-c25a-4472-a9ed-320c6667d317",
secret: "secret-live-80JASucyk7z_G8Z-7dVwZVGXL5NT_qGAQ2I=",
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
project_id: "project-live-c60c0abe-c25a-4472-a9ed-320c6667d317",
secret: "secret-live-80JASucyk7z_G8Z-7dVwZVGXL5NT_qGAQ2I=",
project_id: "YOUR_STYTCH_PROJECT_ID",
secret: "YOUR_STYTCH_SECRET",

This is the pattern we use elsewhere, dealer's choice on which you'd prefer.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The secrets I'm checking in here are a special set we used to have public on the homepage - they produce a specific error and make it easy to confirm network connectivity. I'll add better comments.

@@ -0,0 +1,2 @@
# Exclude lockfiles for packaging tests to reduce file churn
/*/package-lock.json
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there a preference for this over .nvmrc for each project and checking in package-lock.json?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

.nvcmrc for each project would mean many versions of Node, which we don't need... yet

Copy link
Contributor

@jeremy-stytch jeremy-stytch left a comment

Choose a reason for hiding this comment

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

It looks like we commit the lockfiles from each environment-specific package manager, but not any of the package-lock.json files. Is that an important distinction?

(I've never used any of Bun, Deno, etc., but I wouldn't be surprised if the answer is "package-lock.json is derived from the other lockfile".)

.catch((err: unknown) => console.log(JSON.stringify(err)));
}

doStytchRequest();
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this this Promise be await-ed or .then()'d? Does Bun do some magic?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Bun does some magic! Bun won't end the process until the microtask queue is empty. No top-level await nesc.


// Learn more at https://deno.land/manual/examples/module_metadata#concepts
if (import.meta.main) {
doStytchRequest();
Copy link
Contributor

Choose a reason for hiding this comment

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

Similar to Bun, should this have await/.then()? Or is there magic?

@max-stytch
Copy link
Contributor Author

(I've never used any of Bun, Deno, etc., but I wouldn't be surprised if the answer is "package-lock.json is derived from the other lockfile".)

you are correct!

@max-stytch max-stytch temporarily deployed to integration_tests October 12, 2023 00:00 — with GitHub Actions Inactive
@max-stytch max-stytch temporarily deployed to integration_tests October 12, 2023 00:00 — with GitHub Actions Inactive
@max-stytch max-stytch merged commit 2479bd3 into main Oct 12, 2023
9 checks passed
@max-stytch max-stytch deleted the max/node-client-debug branch October 12, 2023 00:03
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.

None yet

3 participants