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

Serverless ssr pages workers refactor #3

Merged

Conversation

thescientist13
Copy link
Member

This is a diff against the main branch but patched to use this initial commit of the workers refactoring PR
ProjectEvergreen/greenwood@c366c32

@vercel
Copy link

vercel bot commented Jun 18, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
greenwood-demo-adapter-vercel ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 29, 2023 2:17am

@thescientist13
Copy link
Member Author

thescientist13 commented Jun 21, 2023

So after syncing with upstream to this commit c366c325, I got this error on Vercel

// ugh, logs only go back an hour, but basically the it was an ESM Module Path not found where the function was calling out to a path from a different directory, that seemed to be the build / CI directory, based on my inference at least

I think because we're now bundling SSR pages, import.meta.url is being resolved at build time by Rollup, when it needs to be resolved at runtime.

(This might also be responsible for the circular dependencies, because I think it was also importing itself!)


So to fix the runtime issue, thought I could get clever and wrap it in a function in commit 22e8389f, but then resulted in this error on Vercel

Unhandled Promise Rejection 	{"errorType":"Runtime.UnhandledPromiseRejection","errorMessage":"Error [ERR_MODULE_NOT_FOUND]: Cannot find module '/var/task/public/_artists.js' imported from /var/task/public/__artists.js","reason":{"errorType":"Error","errorMessage":"Cannot find module '/var/task/public/_artists.js' imported from /var/task/public/__artists.js","code":"ERR_MODULE_NOT_FOUND","stack":["Error [ERR_MODULE_NOT_FOUND]: Cannot find module '/var/task/public/_artists.js' imported from /var/task/public/__artists.js","    at new NodeError (node:internal/errors:399:5)","    at finalizeResolution (node:internal/modules/esm/resolve:331:11)","    at moduleResolve (node:internal/modules/esm/resolve:994:10)","    at moduleResolveWithNodePath (node:internal/modules/esm/resolve:938:12)","    at defaultResolve (node:internal/modules/esm/resolve:1202:79)","    at nextResolve (node:internal/modules/esm/loader:163:28)","    at ESMLoader.resolve (node:internal/modules/esm/loader:838:30)","    at ESMLoader.getModuleJob (node:internal/modules/esm/loader:424:18)","    at ESMLoader.import (node:internal/modules/esm/loader:525:22)","    at importModuleDynamically (node:internal/modules/esm/translators:110:35)"]},"promise":{},"stack":["Runtime.UnhandledPromiseRejection: Error [ERR_MODULE_NOT_FOUND]: Cannot find module '/var/task/public/_artists.js' imported from /var/task/public/__artists.js","    at process.<anonymous> (file:///var/runtime/index.mjs:1189:17)","    at process.emit (node:events:525:35)","    at emit (node:internal/process/promises:149:20)","    at processPromiseRejections (node:internal/process/promises:283:27)","    at process.processTicksAndRejections (node:internal/process/task_queues:96:32)"]}
Unknown application error occurred
Runtime.Unknown

I think I need to go back to the #2 implementation where I used URL directly based implementation, but somehow make sure Rollup doesn't bundle on it.

Copy link
Member Author

@thescientist13 thescientist13 left a comment

Choose a reason for hiding this comment

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

@thescientist13 thescientist13 mentioned this pull request Jun 21, 2023
3 tasks
@thescientist13
Copy link
Member Author

Now it works after upgrading to the alpha release, no more patch-package needed! 🥳

@thescientist13 thescientist13 merged commit 59cacfd into serverless-ssr-pages Jul 4, 2023
@thescientist13 thescientist13 deleted the serverless-ssr-pages-workers-refactor branch July 4, 2023 13:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant