GithubHelp home page GithubHelp logo

opensource's People

Contributors

meixnertobias avatar rayriffy avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

opensource's Issues

netlify-plugin-next-dynamic: 404 on Netlify Form submit

On submitting an ajax form to Netlify Forms, I'm getting a 404 page being served. I have no special _redirects rules either.

curl 'https://beta.dfame.app/' \
  -H 'user-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.66 Safari/537.36' \
  -H 'content-type: application/x-www-form-urlencoded' \
  -H 'referer: https://beta.dfame.app/' \
  -H 'accept-language: en-US,en;q=0.9' \
  -H 'cookie: _gid=GA1.2.1550095432.1605983334; _ga=GA1.1.1307560562.1605983334; _ga_37514942YF=GS1.1.1606014014.5.1.1606017875.0' \
  --data-raw 'form-name=tppCreate&email=a%40az.com&url=demo.ghost.io&address=&balance=1' \
  --compressed

Improve error handling

A top-level try/catch block is present:

This would incorrectly report uncaught exceptions (due to potential bugs) as user errors. Note: uncaught exceptions (e.g. throw new Error() are reported as plugin bugs, while utils.build.failBuild() are reported as user errors.

Instead, try/catch/utils.build.failBuild() should only wrap (as tightly as possible) statements that are known to potentially throw due to user errors. This makes it possible to distinguish between plugin bugs and user errors.

Missing `tslib` in production

The netlify-plugin-next-dynamic is missing the tslib dependency in production:

Could not import plugin:
Cannot find module 'tslib'
Require stack:
- /opt/build/repo/.netlify/plugins/node_modules/netlify-plugin-next-dynamic/index.js
- /opt/buildhome/.netlify-build-nvm/versions/node/v12.16.3/lib/node_modules/@netlify/build/src/plugins/child/logic.js
- /opt/buildhome/.netlify-build-nvm/versions/node/v12.16.3/lib/node_modules/@netlify/build/src/plugins/child/load.js
- /opt/buildhome/.netlify-build-nvm/versions/node/v12.16.3/lib/node_modules/@netlify/build/src/plugins/child/main.js 
    internal/modules/cjs/loader.js:957:15 Function.Module._resolveFilename
    internal/modules/cjs/loader.js:840:27 Function.Module._load
    internal/modules/cjs/loader.js:1019:19 Module.require
    internal/modules/cjs/helpers.js:77:18 require
    /opt/build/repo/.netlify/plugins/node_modules/netlify-plugin-next-dynamic/index.js:4:17 Object.<anonymous>
    internal/modules/cjs/loader.js:1133:30 Module._compile
    internal/modules/cjs/loader.js:1153:10 Object.Module._extensions..js
    internal/modules/cjs/loader.js:977:32 Module.load
    internal/modules/cjs/loader.js:877:14 Function.Module._load
    internal/modules/cjs/loader.js:1019:19 Module.require

If you check the transpiled code of index.js:

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.onPostBuild = void 0;
const tslib_1 = require("tslib");
const generateRedirects_1 = require("./functions/generateRedirects");
const path = require("path");
exports.onPostBuild = (opts) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
    const { constants, inputs } = opts;
    const { nextDir = path.join(constants.PUBLISH_DIR, '../.next') } = inputs;
    yield generateRedirects_1.generateRedirects(opts)(nextDir, constants.PUBLISH_DIR);
});
//# sourceMappingURL=index.js.map

You see that tslib is required to transpile async/await. To make it work, I believe you would need to either:

  • Require tslib as a production dependency
  • Use the target TypeScript option in order to inline tslib helpers

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.