@server/next 0.20.35 → 0.20.37

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@server/next",
3
- "version": "0.20.35",
3
+ "version": "0.20.37",
4
4
  "description": "A fully-fledged web server with routing, file uploads, sessions, static files, schema validation, websockets, testing, etc.",
5
5
  "homepage": "https://server-js.com/",
6
6
  "repository": "https://github.com/franciscop/server-next.git",
@@ -23,7 +23,7 @@ export default function getMachine() {
23
23
  // Can I cry now?
24
24
  production:
25
25
  provider === "netlify"
26
- ? Netlify.env.get("NETLIFY_DEV") === "true"
26
+ ? Netlify.env.get("NETLIFY_DEV") !== "true"
27
27
  : process.env.NODE_ENV === "production",
28
28
  };
29
29
  }
@@ -39,7 +39,9 @@ export default async function handleRequest(handlers, ctx) {
39
39
 
40
40
  // In Netlify, a non-response is perfectly valid, which would indicate
41
41
  // the edge function to just go ahead and consume the original resource
42
- if (ctx.platform.provider === "netlify") return;
42
+ if (ctx.platform.provider === "netlify") {
43
+ return ctx.req.context.next();
44
+ }
43
45
 
44
46
  // In other environments, a non-response is wrong and we should 404 then
45
47
  return new Response("Not Found", { status: 404 });
package/src/index.js CHANGED
@@ -104,7 +104,8 @@ server.prototype.node = async function () {
104
104
  };
105
105
 
106
106
  // Netlify
107
- server.prototype.callback = async function (request) {
107
+ server.prototype.callback = async function (request, context) {
108
+ request.context = context;
108
109
  try {
109
110
  if (typeof Netlify === "undefined") {
110
111
  throw new Error("Netlify doesn't exist");