Can't get it working with Pulumi
See original GitHub issueSo I’m trying to deploy to AWS Lambda using Pulumi, I’m not sure, it might be a Pulumi bundling issue, though before I hadn’t issues with that.
I’ve got a separate ./server/lambda.ts
which includes import "../dist/server/importBuild";
And as importBuild
includes const { __private: { importBuild } } = require("vite-plugin-ssr")
it should import vite-plugin-ssr/dist/cjs/index.js
or am I missing some additional Typescript config? I’ve added "esModuleInterop": true,
with no change
Here’s the full error I get when testing the Lambda via AWS Console:
{
"errorType": "Error",
"errorMessage": "Cannot find module 'vite-plugin-ssr/dist/cjs/index.js'\nRequire stack:\n- /var/task/__index.js\n- /var/runtime/UserFunction.js\n- /var/runtime/index.js",
"trace": [
"Error: Cannot find module 'vite-plugin-ssr/dist/cjs/index.js'",
"Require stack:",
"- /var/task/__index.js",
"- /var/runtime/UserFunction.js",
"- /var/runtime/index.js",
" at Function.Module._resolveFilename (internal/modules/cjs/loader.js:889:15)",
" at Function.Module._load (internal/modules/cjs/loader.js:745:27)",
" at Module.require (internal/modules/cjs/loader.js:961:19)",
" at require (internal/modules/cjs/helpers.js:92:18)",
" at /var/task/__index.js:48:73",
" at Runtime.__f1 [as handler] (/var/task/__index.js:120:6)",
" at Runtime.handleOnce (/var/runtime/Runtime.js:66:25)"
]
}
Update: just updated vite-plugin-ssr
from 0.2.3
to 0.2.9
and vite
from 2.4.2
to 2.5.0
without any luck
Issue Analytics
- State:
- Created 2 years ago
- Comments:11 (9 by maintainers)
Top Results From Across the Web
Troubleshooting Guide - Pulumi
This guide covers common troubleshooting techniques when using Pulumi, such as tracing, manually editing deployments, and resolving common errors.
Read more >Things I Wish I Knew Earlier About Pulumi - vsupalov.com
Sometimes, it doesn't completely work out though. If you have parts which rely on each other, but it's not completely obvious to Pulumi,...
Read more >Infrastructure as Code - An intro - Part 6 - Using Pulumi
And if you can't find a provider for your scenario, you can quite easily ... The tools used for working with Pulumi is...
Read more >Getting started with New Relic and Pulumi
To use this guide, you should have some basic knowledge of New Relic, Pulumi, and TypeScript. Additionally, since you'll be working with Pulumi...
Read more >Deploying And Managing Cloud Infrastructure With Pulumi
Show Links: Get Started With Pulumi ... So working at Pulumi, and that is the focus of the show. ... Pulumi doesn't have...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
This doesn’t seem to be related to vite-plugin-ssr.
The error
contradicts the fact that the file
node_modules/vite-plugin-ssr/dist/cjs/node/index.js
does exist.Something’s wrong with the Pulumi environment. I’d open a GitHub issue over there.
You can try to
require('vite-plugin-ssr')
directly in yourlambda.ts
and see if it works. I’d investigate in that direction.Ah, got it all working with minimal fuss. Happy to share.