Git Product home page Git Product logo

nitro-demo's Introduction

nitro-demo's People

Contributors

atinux avatar changjoo-park avatar danielroe avatar msftgits avatar pi0 avatar renovate-bot avatar renovate[bot] avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

nitro-demo's Issues

Wrong server url matching

I have 2 similar endpoints /api/post and /api/posts, /api/posts will always return /api/post result

https://nuxt-nitro-apis.vercel.app/api/post

// ./server/api/post.js
export default (req) => {
  return {
    title: "sunt aut facere ...",
    body: "quia et suscipit\nsuscipit re ..."
  };
};

https://nuxt-nitro-apis.vercel.app/api/posts (it returns wrong data)

// ./server/api/posts.js
export default (req) => {
  return [
    {
      title: "sunt aut facere repellat...",
      body: "quia et suscipit\nsuscipit recusandae...."
    },
    {
      title: "qui est esse ...",
      body: "est rerum te ..."
    }
  ];
};

Repo: https://github.com/KABBOUCHI/nuxt-nitro-apis
URL: https://nuxt-nitro-apis.vercel.app/

cloudflare is broken

Workers use utils polyfill which uses available-types-arrays internally. Seems there is a rollup issue. Made a reproduction to investigate

Cannot Build Demo

FATAL Package subpath './dist/index.mjs' is not defined by "exports" in /Volumes/Code/nitro-demo/node_modules/ufo/package.json 11:27:56

at applyExports (internal/modules/cjs/loader.js:491:9)
at resolveExports (internal/modules/cjs/loader.js:507:23)
at Function.Module._findPath (internal/modules/cjs/loader.js:635:31)
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:953:27)
at Function.resolve (internal/modules/cjs/helpers.js:78:19)
at Function.m [as resolve] (node_modules/jiti/dist/jiti.js:1:52865)
at Object.resolveModule (node_modules/@nuxt/kit/dist/index.js:92:19)
at node_modules/@nuxt/nitro/dist/compat.js:102:40
at node_modules/hable/dist/hable.js:1:990
at node_modules/hable/dist/hable.js:1:208
at async Nuxt.callHook (node_modules/hable/dist/hable.js:1:959)
at async WebpackBundler.build (node_modules/@nuxt/webpack-edge/dist/webpack.js:2155:5)
at async Builder.build (node_modules/@nuxt/builder-edge/dist/builder.js:327:5)
at async ensureBuild (node_modules/@nuxt/cli-edge/dist/cli-generate.js:145:3)
at async Object.run (node_modules/@nuxt/cli-edge/dist/cli-generate.js:283:7)
at async NuxtCommand.run (node_modules/@nuxt/cli-edge/dist/cli-index.js:413:7)

cannot run demo

I did clone, yarn install and tried

npm run build
npm run start
wrangler dev

nothing works
Screen Shot 2021-09-19 at 05 43 11
Screen Shot 2021-09-19 at 05 42 58

Action Required: Fix Renovate Configuration

There is an error with this repository's Renovate configuration that needs to be fixed. As a precaution, Renovate will stop PRs until it is resolved.

Error type: undefined. Note: this is a nested preset so please contact the preset author if you are unable to fix it yourself.

Cannot start demo

Hello @pi0 and @danielroe !

I tried to run this demo on my local. It is not working with yarn dev or node .output/server after build.

$ yarn generate
yarn run v1.22.10
$ nuxt generate
i Doing webpack rebuild because yarn.lock modified                                                                                                                                                                                      14:48:56
i Production build                                                                                                                                                                                                                      14:48:56
i Bundling for server and client side                                                                                                                                                                                                   14:48:56
i Target: static                                                                                                                                                                                                                        14:48:56  
√ Builder initialized                                                                                                                                                                                                                   14:48:56  
√ Nuxt files generated                                                                                                                                                                                                                  14:48:56

√ Client
  Compiled successfully in 4.88s

√ Server
  Compiled successfully in 439.51ms


Hash: bf52cddb9a0b38bc6927
Version: webpack 4.46.0
Time: 4876ms
Built at: 2021. 04. 13. 오후 2:49:02
                         Asset       Size  Chunks                         Chunk Names
../server/client.manifest.json   9.15 KiB          [emitted]
                    4110d53.js    165 KiB       1  [emitted] [immutable]  commons/app
                    64a4772.js   62.7 KiB       7  [emitted] [immutable]  vendors/app
                    8ce77f7.js   8.24 KiB       0  [emitted] [immutable]  app
                    9145fcc.js   1.14 KiB       3  [emitted] [immutable]  pages/about
                      LICENSES  390 bytes          [emitted]
                    bc54d5d.js   1.02 KiB       5  [emitted] [immutable]  pages/graphql
                    c9d0a3c.js   1.73 KiB       4  [emitted] [immutable]  pages/api
                    d832ac7.js   2.33 KiB       6  [emitted] [immutable]  runtime
                    fb34828.js   1.55 KiB       2  [emitted] [immutable]  pages/_
       img/camping.744f3d2.svg   11.3 KiB          [emitted] [immutable]
img/drop_the_quote.b4000fb.svg    3.1 KiB          [emitted] [immutable]
 + 2 hidden assets
Entrypoint app = d832ac7.js 4110d53.js 64a4772.js 8ce77f7.js

Hash: 65db2209af241393339f
Version: webpack 4.46.0
Time: 440ms
Built at: 2021. 04. 13. 오후 2:49:02
               Asset       Size  Chunks             Chunk Names
          pages/_.js   5.65 KiB       1  [emitted]  pages/_
      pages/about.js   4.78 KiB       2  [emitted]  pages/about
        pages/api.js   2.78 KiB       3  [emitted]  pages/api
    pages/graphql.js   5.32 KiB       4  [emitted]  pages/graphql
           server.js   99.7 KiB       0  [emitted]  app
server.manifest.json  239 bytes          [emitted]
Entrypoint app = server.js
i Full static generation activated                                                                                                                                                                                                      14:49:03
i Nitro preset is server                                                                                                                                                                                                                14:49:03
i Cleaning up .output                                                                                                                                                                                                                   14:49:03  
i Generating output directory: public/                                                                                                                                                                                                  14:49:03  
start Building server...                                                                                                                                                                                                                14:49:03

 ERROR  Rollup error: Bad character escape sequence (Note that you need plugins to import files that are not JavaScript)                                                                                                                14:49:03  


 FATAL  Bad character escape sequence (Note that you need plugins to import files that are not JavaScript)                                                                                                                              14:49:03  

  at error (node_modules\rollup\dist\shared\rollup.js:5305:30)
  at Module.error (node_modules\rollup\dist\shared\rollup.js:9750:16)
  at Module.tryParse (node_modules\rollup\dist\shared\rollup.js:10156:25)
  at Module.setSource (node_modules\rollup\dist\shared\rollup.js:10057:24)
  at ModuleLoader.addModuleSource (node_modules\rollup\dist\shared\rollup.js:18403:20)
  at async ModuleLoader.fetchModule (node_modules\rollup\dist\shared\rollup.js:18459:9)
  at async Promise.all (index 0)
  at async ModuleLoader.fetchStaticDependencies (node_modules\rollup\dist\shared\rollup.js:18485:34)
  at async Promise.all (index 0)
  at async ModuleLoader.fetchModule (node_modules\rollup\dist\shared\rollup.js:18461:9)
  at async Promise.all (index 0)


   ╭───────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
   │                                                                                                               │
   │   ✖ Nuxt Fatal Error                                                                                          │
   │                                                                                                               │
   │   Error: Bad character escape sequence (Note that you need plugins to import files that are not JavaScript)   │
   │                                                                                                               │
   ╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────╯

error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

It happen with Promise.all. It related with h3? I want to run this demo on my PC 😭

Dependency Dashboard

This issue provides visibility into Renovate updates and their statuses. Learn more

Open

These updates have all been created already. Click a checkbox below to force a retry/rebase of any.


  • Check this box to trigger a request for Renovate to run again on this repository

GitHub demo errors

It says loading forever and errors out with

Uncaught (in promise) TypeError: Failed to register a ServiceWorker for scope ('https://nuxt.github.io/nitro-demo/') with script ('https://nuxt.github.io/nitro-demo/sw.js'): ServiceWorker script evaluation failed

Redirects yield Server Errors

Using { redirect } from context inside middleware or asyncData yields a server error

Cannot set headers after they are sent to the client
  at ServerResponse.setHeader (_http_outgoing.js:518:11)  
  at renderMiddleware (./node_modules/@nuxt/nitro/dist/runtime/app/render.mjs:53:9)  
  at processTicksAndRejections (internal/process/task_queues.js:97:5)  
  at handle2 (./node_modules/h3/dist/index.js:558:19)
<template>
    <div>hi</div>
</template>
<script>
export default {
    middleware({ redirect }){
        redirect('/no-access')
    },
}
</script>

Both Azure examples down

Hello 👋. This is an amazing repo, I love the concept of having a benchmark app deployed across multiple providers. Bravo to all the contributors.

Problems with Azure

There's only a few open issues and I didn't see any for this, so it seemed worth mentioning that as of right now (October 14, ~10pm PST) both of the Azure examples are returning errors. (As someone who has deployed to all of these providers before, I always found Azure's cloud to be an order of magnitude more complex while simultaneously being an order of magnitude more poorly documented, so I sympathize).

Azure Demo

When visiting nitro-azure-demo in a Chrome browser, the following message is displayed:

Your connection is not private

Attackers might be trying to steal your information from nitro-azure-demo.nuxtjs.org (for example, passwords, messages, or credit cards).

NET::ERR_CERT_COMMON_NAME_INVALID

This server could not prove that it is nitro-azure-demo.nuxtjs.org; its security certificate is from *.staticsites-prod-westus2.p.azurewebsites.net. This may be caused by a misconfiguration or an attacker intercepting your connection.

After proceeding to the allegedly unsafe site you see:

The resource you are looking for has been removed, had its name changed, or is temporarily unavailable.

After opening it again in a new tab I received a different error message.

404 Web Site not found.

You may be seeing this error due to one of the reasons listed below :

  • Custom domain has not been configured inside Azure. See how to map an existing domain to resolve this.
  • Client cache is still pointing the domain to old IP address. Clear the cache by running the command ipconfig/flushdns.

Checkout App Service Domain FAQ for more questions.

Azure Static Web Apps

SWA is a lot less interesting. According to the error message, it is broken. Useful information for sure.

This page isn’t working

nuxt-sigma.azurewebsites.net is currently unable to handle this request.

HTTP ERROR 500

Remind me again what 500 means?

The HyperText Transfer Protocol (HTTP) 500 Internal Server Error server error response code indicates that the server encountered an unexpected condition that prevented it from fulfilling the request.

Usually, this indicates the server cannot find a better 5xx error code to response.

feature: @nuxt/image

I noticed that the @nuxt/image package does not work with this demo and maybe the @nuxt/nitro package itself.

Folder .vercel_build_output/config/images.json is not generated.

When built without nitro, everything works beautifully with the package @nuxt/image.

Is there any setup that would make the images work with nitro?

Error during build: Server is not running.

Hello,

I just checked out the project and tried to build it. Unfortunately it runs into an error.

Versions
MacOS 10.15.7
Node v14.12.0
Yarn 1.22.4

Steps to reproduce
Check out latest version
Run yarn
Run yarn build

What is expected
Build without errors

What is actual happening
Process throws error:
`✔ Ready to run node .output/server 20:32:08

FATAL Server is not running. 20:32:08

at Server.close (net.js:1605:12)
at Object.onceWrapper (events.js:420:28)
at Server.emit (events.js:314:20)
at Server.EventEmitter.emit (domain.js:486:12)
at emitCloseNT (net.js:1658:8)
at processTicksAndRejections (internal/process/task_queues.js:79:21)
`

yarn dev runs without any problems...

Thanks for this great approach, to make it possible to run nuxt on Cloudflare workers...
Carsten

issue with bundling images

generated HTML of <img> tag shows require is returning a promise and not a string:

<img src="[object Promise]" alt="Drop the quuote">

Possibly an issue with sigma or related to nuxt/nuxt#7328?

Missing query params in request url for Netlify and Cloudflare Worker

https://github.com/KABBOUCHI/nuxt-nitro-demo/blob/bc8fd5f0bd767598d1939eeb7e89c295a3d37596/server/api/hello.ts#L1-L13

// ./server/api/hello.ts
import { useQuery } from "h3";

export default (req) => {
  return {
    message: "hi",

    request: {
      url: req.url,
      method: req.method,
      query: useQuery(req),
    },
  };
};

Vercel: https://nuxt-nitro-demo.vercel.app/api/hello?test1=1&test2=2

{
   "message":"hi",
   "request":{
      "url":"?test1=1&test2=2",
      "method":"GET",
      "query":{
         "test1":"1",
         "test2":"2"
      }
   }
}

Netlify: https://nuxt-nitro-demo.netlify.app/api/hello?test1=1&test2=2

{
   "message":"hi",
   "request":{
      "url":"/",
      "method":"GET",
      "query":{
         
      }
   }
}

url should be event.path + event.queryStringParameters

// .output/server/chunks/nitro/lambda.js

async function handler(event, context) {
  const r = await localCall({
    event,
    url: event.path,
    context,
    headers: event.headers,
    method: event.httpMethod,
    query: event.queryStringParameters,
    body: event.body
  });
  return {
    statusCode: r.status,
    headers: r.headers,
    body: r.body.toString()
  };
}

possible solution:

const { withQuery } = require('ufo')

const r = await localCall({
    event,
    url: withQuery(event.path, event.queryStringParameters),
    ....

Cloudflare: https://nuxt-nitro-demo.kabbouchi.workers.dev/api/hello?test1=1&test2=2

{
   "message":"hi",
   "request":{
      "url":"/",
      "method":"GET",
      "query":{
         
      }
   }
}

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.