-
-
Notifications
You must be signed in to change notification settings - Fork 469
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 Functions returning as Invalid URL #2441
Comments
I’m curious if your serverless Can you log it out in async function handler(event) {
console.log(event.rawUrl);
let elev = new EleventyServerless("serverless", {
path: new URL(event.rawUrl).pathname,
query: event.queryStringParameters,
functionsDir: "./netlify/functions/",
});
// …
|
Hey @zachleat, appreciate the quick response! The
This however still returns the same invalid URL error as before. You can see the full log below with the event.rawUrl, event.path, and then the error:
I also tried to replace the entire variable with event.path seen here:
Which then resulted in the following Serverless Error:
|
Hey @zachleat, following up here. Any ideas how I could further debug the issue to get the functions working? |
Hey, I think there are probably a few issues to go through here. If you’re not seeing Next it seems like you’re missing the |
Hey @zachleat that worked! Thanks for clarifying. Although I'm now running into the same issue that Knut was having in the video linked above where all pagination pages are returning the data from the first document in the array of documents. For example,
|
Hi @zachleat wanted to follow up with the solution I came up with to assign the correct data for each paginated page, but would be interested to hear if there's a better way to do it:
It seems that the default index.js script assumes that the page.content assigned to the body should always come from the first object returned from |
hey @zachleat could you clarify why elev.getOutput returns an array of all documents within the paginated template even after specifying the path in the EleventyServerless options? I got the above solution to work by filtering through these documents, but on some of the sites with high volumes of documents within a paginated template the netlify function times out. Ideally the path specified in the options Is the only document fetched during |
Same issue here. The serverless function always returns the first item in the pagination array. Using 2.0.0-canary.15. |
Thank you for this. |
Were you able to handle the scenario where you need Eleventy tells me I can't seem to figure out if it's a eleventy issue or if I need to add an extra route to my netlify.toml file. Something that can handle a wildcard instead of
|
Stale per project slipstream changes in #3074. |
Describe the bug
Hi, I am attempting to configure serverless functions with Sanity to create a live content preview within the Sanity dashboard as seen here. I have setup the serverless function in the .eleventy.js file and am getting the correct output in the ./netlify/functions/serverless folder, but it seems the url that the template is attempting to use for the preview slug is returning as invalid which in turn blocks the preview pages from rendering. The error returned on the page is:
The error returned in the console is:
To Reproduce
Steps to reproduce the behavior:
netlify dev
Expected behavior
A new preview page would be built e.g. /preview/dynamic-slug with the live content from the sanity dashboard along with the original static page
Environment:
Additional context
I reviewed multiple setups of serverless functions within the eleventy templates, and ultimately tried to follow the sanity walkthrough above as close as possible though I understand it was an older case and things may have changed since then. For additional context, I also tried different versions of the eleventy 1.0 e.g. beta versions as well as older versions of the @netlify/functions package but those unfortunately threw other errors. Any references for a working setup similar to this configuration or tips to debug this issue would be appreciated!
The text was updated successfully, but these errors were encountered: