question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Hi,

I’m attempting to set up a project consisting of Serverless Stack and Vite SSR (Vue). I’ve set up the following Lambda function:

import { APIGatewayProxyHandlerV2 } from "aws-lambda";
import { createPageRenderer } from "vite-plugin-ssr";

const renderPage = createPageRenderer({
  isProduction: true,
  root: `${__dirname}/..`,
});

export const handler: APIGatewayProxyHandlerV2 = async (event) => {
  let url = event.rawPath;

  if (event.rawQueryString) {
    url += "?" + event.rawQueryString;
  }

  const pageContextInit = { url };
  const pageContext = await renderPage(pageContextInit);
  const { httpResponse } = pageContext;
  if (!httpResponse) return { statusCode: 200, body: "??" };
  const { body, statusCode, contentType } = httpResponse;

  return {
    statusCode,
    headers: { "Content-Type": contentType },
    body,
  };
};

And when I invoke the function by opening the API Gateway URL in my browser, I get:

Error: [vite-plugin-ssr@0.3.36][Internal Failure] You stumbled upon a bug in the source code of vite-plugin-ssr (an internal assertion failed). This should not be happening: please reach out at https://github.com/brillout/vite-plugin-ssr/issues/new or https://discord.com/invite/qTq92FQzKb and include this error stack (the error stack is usually enough to fix the problem). Please do reach out as it helps make vite-plugin-ssr more robust. A fix will be written promptly (usually under 24 hours).
    at setPageFiles (/Volumes/SuperData/Sites/reelcrafter/v2-presentation2/.sst/artifacts/3fa176ba/src/lambda.js:1017:27)
    at getAllPageFiles (/Volumes/SuperData/Sites/reelcrafter/v2-presentation2/.sst/artifacts/3fa176ba/src/lambda.js:878:43)
    at getGlobalContext (/Volumes/SuperData/Sites/reelcrafter/v2-presentation2/.sst/artifacts/3fa176ba/src/lambda.js:3863:69)
    at initializePageContext (/Volumes/SuperData/Sites/reelcrafter/v2-presentation2/.sst/artifacts/3fa176ba/src/lambda.js:3349:35)
    at renderPage2 (/Volumes/SuperData/Sites/reelcrafter/v2-presentation2/.sst/artifacts/3fa176ba/src/lambda.js:3261:33)
    at renderPageWithoutThrowing (/Volumes/SuperData/Sites/reelcrafter/v2-presentation2/.sst/artifacts/3fa176ba/src/lambda.js:3357:34)
    at Runtime.handler (/Volumes/SuperData/Sites/reelcrafter/v2-presentation2/.sst/artifacts/3fa176ba/src/lambda.js:4067:29)
    at Runtime.handleOnce (/Volumes/SuperData/Sites/reelcrafter/v2-presentation2/node_modules/@serverless-stack/aws-lambda-ric/lib/Runtime/Runtime.js:76:33)

Let me know if you’d like access to the full project.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:23 (11 by maintainers)

github_iconTop GitHub Comments

1reaction
ffxsamcommented, Feb 11, 2022

@brillout Sorry it took so long, things have been busy here!

https://github.com/brillout/vite-plugin-ssr/pull/260/

1reaction
brilloutcommented, Dec 15, 2021

Let me have a look

Read more comments on GitHub >

github_iconTop Results From Across the Web

SST
Build modern full-stack applications on AWS ... Add a dedicated serverless GraphQL or REST API to your app. stacks/api.js. 1 new Api(this, "api",...
Read more >
SST makes it easy to build full-stack serverless apps. - GitHub
SST makes it easy to build full-stack serverless applications on AWS. High-level components to simplify building APIs, databases, and frontends on AWS.
Read more >
Serverless Stack: Building a Full-Stack App with Serverless ...
Serverless Stack is a completely free resource to help you build full-stack production ready Serverless applications. First, you'll learn how to build a...
Read more >
Serverless Computing – Amazon Web Services
We've developed serverless services for all three layers of your stack: compute, integration, and data stores. Consider getting started with these services: ...
Read more >
Getting Started with the Serverless Stack (SST) Framework
serverless -stack.com. Installation: Serverless is a collection of Node NPM packages, and that allows you to create a package.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found