qwik icon indicating copy to clipboard operation
qwik copied to clipboard

Qwik City Netlify starter does not build

Open Priestch opened this issue 2 years ago • 15 comments

Qwik Version

0.0.39

Operating System (or Browser)

Ubuntu 22.04.1

Node Version (if applicable)

v16.15.0

Which component is affected?

Starters / CLI

Expected Behaviour

  1. npm init qwik@latest - select Qwik City with Netlify
  2. npm install
  3. npm build - current build throw error, and I manually fixed errors following #938
  4. deploy to netlify

Expected: should show the initial start example

following

Actual Behaviour

Netlify site shows "TypeError: Cannot read properties of undefined (reading 'write')" on the page, with a 500 HTTP error when fetching /

Additional Information

// ./netlify/edge-functions/entry.netlify/entry.netlify.js

// ...
const write = opts.stream.write.bind(opts.stream);
const createDocTimer = createTimer();
const doc = _createDocument(opts);
// ...

renderToStream function in entry.ssr.tsx expects ops argument has a stream object with a write function.

Maybe the starter needs a proper @builder.io/qwik

Priestch avatar Aug 06 '22 04:08 Priestch

Hey @Priestch! What is your Qwik City version?

nnelgxorz avatar Aug 06 '22 04:08 nnelgxorz

It is 0.0.26, https://github.com/Priestch/qwick-city-demo is the repo if helps, sorry for the typo.

Priestch avatar Aug 06 '22 06:08 Priestch

Yeah I'm having issues with the deploy on Netlify too

Versions:

    "@builder.io/qwik": "0.0.39",
    "@builder.io/qwik-city": "0.0.26",

renanlopescoder avatar Aug 06 '22 16:08 renanlopescoder

Cool. Everything is kind off of while the beta is being worked on, so things are out of date, the CLI is one.

I submitted a PR to you @Priestch that gets you up and running.

@renanlopescoder Here's the steps I took to get @Priestch's project running.

npm i @builder.io/qwik-city@latest npm i @builder.io/[email protected] (this a dev release, you can update to 0.0.40 when it releases) Change entry.netlify.ts to match current version the repo here: https://github.com/BuilderIO/qwik/blob/main/starters/servers/netlify-edge/src/entry.netlify.ts useScopedStyles$ is now useStylesScoped$ so do a find and replace.

Hope that helps!

nnelgxorz avatar Aug 06 '22 17:08 nnelgxorz

@nnelgxorz after the updates mentioned the build works fine and the pipeline runs but I get errors on the Edge functions when I access the deployed URL

Screenshot 2022-08-06 at 19 28 38

The issue now is that Edge function logs aren't available to verify and debug

Screenshot 2022-08-06 at 19 31 33

renanlopescoder avatar Aug 06 '22 17:08 renanlopescoder

@renanlopescoder What does the function log say?

nnelgxorz avatar Aug 06 '22 17:08 nnelgxorz

@nnelgxorz The Edge Log

Screenshot 2022-08-06 at 19 35 32

Build Log

7:27:53 PM: Build ready to start
7:27:55 PM: build-image version: d7b3dbfb0846505993c9a131894d1858074c90b4 (focal)
7:27:55 PM: build-image tag: v4.10.1
7:27:55 PM: buildbot version: fe6512288e75c8fa5aadaebb51ed1f96e9314fd4
7:27:55 PM: Fetching cached dependencies
7:27:55 PM: Starting to download cache of 153.1MB
7:27:57 PM: Finished downloading cache in 1.038563505s
7:27:57 PM: Starting to extract cache
7:28:00 PM: Finished extracting cache in 3.037567298s
7:28:00 PM: Finished fetching cache in 4.126531843s
7:28:00 PM: Starting to prepare the repo for build
7:28:00 PM: Preparing Git Reference refs/heads/master
7:28:00 PM: Parsing package.json dependencies
7:28:01 PM: Starting build script
7:28:01 PM: Installing dependencies
7:28:01 PM: Python version set to 2.7
7:28:01 PM: Started restoring cached node version
7:28:02 PM: Finished restoring cached node version
7:28:02 PM: Attempting node version '16' from .node-version
7:28:03 PM: v16.16.0 is already installed.
7:28:03 PM: Now using node v16.16.0 (npm v8.11.0)
7:28:03 PM: Started restoring cached build plugins
7:28:03 PM: Finished restoring cached build plugins
7:28:03 PM: Attempting ruby version 2.7.2, read from environment
7:28:04 PM: Using ruby version 2.7.2
7:28:04 PM: Using PHP version 8.0
7:28:04 PM: No npm workspaces detected
7:28:04 PM: Started restoring cached node modules
7:28:04 PM: Finished restoring cached node modules
7:28:04 PM: Installing NPM modules using NPM version 8.11.0
7:28:05 PM: npm WARN config tmp This setting is no longer used.  npm stores temporary files in a special
7:28:05 PM: npm WARN config location in the cache, and they are managed by
7:28:05 PM: npm WARN config     [`cacache`](http://npm.im/cacache).
7:28:05 PM: npm WARN config tmp This setting is no longer used.  npm stores temporary files in a special
7:28:05 PM: npm WARN config location in the cache, and they are managed by
7:28:05 PM: npm WARN config     [`cacache`](http://npm.im/cacache).
7:28:06 PM: changed 2 packages, and audited 430 packages in 2s
7:28:06 PM: 119 packages are looking for funding
7:28:06 PM:   run `npm fund` for details
7:28:06 PM: 1 moderate severity vulnerability
7:28:06 PM: To address all issues, run:
7:28:06 PM:   npm audit fix --force
7:28:06 PM: Run `npm audit` for details.
7:28:06 PM: NPM modules installed
7:28:07 PM: npm WARN config tmp This setting is no longer used.  npm stores temporary files in a special
7:28:07 PM: npm WARN config location in the cache, and they are managed by
7:28:07 PM: npm WARN config     [`cacache`](http://npm.im/cacache).
7:28:07 PM: Started restoring cached go cache
7:28:07 PM: Finished restoring cached go cache
7:28:07 PM: Installing Go version 1.17 (requested 1.17)
7:28:11 PM: unset GOOS;
7:28:11 PM: unset GOARCH;
7:28:11 PM: export GOROOT='/opt/buildhome/.gimme/versions/go1.17.linux.amd64';
7:28:11 PM: export PATH="/opt/buildhome/.gimme/versions/go1.17.linux.amd64/bin:${PATH}";
7:28:11 PM: go version >&2;
7:28:11 PM: export GIMME_ENV="/opt/buildhome/.gimme/env/go1.17.linux.amd64.env"
7:28:11 PM: go version go1.17 linux/amd64
7:28:11 PM: Installing missing commands
7:28:11 PM: Verify run directory
7:28:12 PM: ​
7:28:12 PM: ────────────────────────────────────────────────────────────────
7:28:12 PM:   Netlify Build                                                 
7:28:12 PM: ────────────────────────────────────────────────────────────────
7:28:12 PM: ​
7:28:12 PM: ❯ Version
7:28:12 PM:   @netlify/build 27.9.1
7:28:12 PM: ​
7:28:12 PM: ❯ Flags
7:28:12 PM:   baseRelDir: true
7:28:12 PM:   buildId: 62eea49956903e00088b004d
7:28:12 PM:   deployId: 62eea49956903e00088b004f
7:28:12 PM:   systemLogFile: 3
7:28:12 PM: ​
7:28:12 PM: ❯ Current directory
7:28:12 PM:   /opt/build/repo
7:28:12 PM: ​
7:28:12 PM: ❯ Config file
7:28:12 PM:   /opt/build/repo/netlify.toml
7:28:12 PM: ​
7:28:12 PM: ❯ Context
7:28:12 PM:   production
7:28:12 PM: ​
7:28:12 PM: ────────────────────────────────────────────────────────────────
7:28:12 PM:   1. build.command from netlify.toml                            
7:28:12 PM: ────────────────────────────────────────────────────────────────
7:28:12 PM: ​
7:28:12 PM: $ npm run build
7:28:13 PM: npm WARN config tmp This setting is no longer used.  npm stores temporary files in a special
7:28:13 PM: npm WARN config location in the cache, and they are managed by
7:28:13 PM: npm WARN config     [`cacache`](http://npm.im/cacache).
7:28:13 PM: > build
7:28:13 PM: > npm run typecheck && npm run build.client && npm run build.ssr
7:28:13 PM: npm WARN config tmp This setting is no longer used.  npm stores temporary files in a special
7:28:13 PM: npm WARN config location in the cache, and they are managed by
7:28:13 PM: npm WARN config     [`cacache`](http://npm.im/cacache).
7:28:13 PM: > typecheck
7:28:13 PM: > tsc --incremental --noEmit
7:28:14 PM: npm WARN config tmp This setting is no longer used.  npm stores temporary files in a special
7:28:14 PM: npm WARN config location in the cache, and they are managed by
7:28:14 PM: npm WARN config     [`cacache`](http://npm.im/cacache).
7:28:14 PM: > build.client
7:28:14 PM: > vite build
7:28:15 PM: vite v3.0.2 building for production...
7:28:15 PM: transforming...
7:28:17 PM: ✓ 89 modules transformed.
7:28:17 PM: rendering chunks...
7:28:17 PM: dist/q-manifest.json        8.80 KiB
7:28:17 PM: dist/build/q-48ac0128.js    0.06 KiB / gzip: 0.07 KiB
7:28:17 PM: dist/build/q-497a2248.js    0.24 KiB / gzip: 0.20 KiB
7:28:17 PM: dist/build/q-0f4f5d1a.js    1.33 KiB / gzip: 0.78 KiB
7:28:17 PM: dist/build/q-4783a422.js    0.50 KiB / gzip: 0.37 KiB
7:28:17 PM: dist/build/q-77f2cdae.js    0.33 KiB / gzip: 0.26 KiB
7:28:17 PM: dist/build/q-47411207.js    0.76 KiB / gzip: 0.43 KiB
7:28:17 PM: dist/build/q-9746313f.js    0.11 KiB / gzip: 0.12 KiB
7:28:17 PM: dist/build/q-d85ffc39.js    0.42 KiB / gzip: 0.20 KiB
7:28:17 PM: dist/build/q-e978a5e9.js    0.20 KiB / gzip: 0.17 KiB
7:28:17 PM: dist/build/q-954c7e05.js    0.28 KiB / gzip: 0.22 KiB
7:28:17 PM: dist/build/q-a92bd9e7.js    0.23 KiB / gzip: 0.19 KiB
7:28:17 PM: dist/build/q-9ea5e7d4.js    0.31 KiB / gzip: 0.23 KiB
7:28:17 PM: dist/build/q-427b53a8.js    0.80 KiB / gzip: 0.50 KiB
7:28:17 PM: dist/build/q-508d26c6.js    0.18 KiB / gzip: 0.16 KiB
7:28:17 PM: dist/build/q-d1b63990.js    0.87 KiB / gzip: 0.48 KiB
7:28:17 PM: dist/build/q-6de8a9d8.js    1.42 KiB / gzip: 0.70 KiB
7:28:17 PM: dist/build/q-a4753b90.css   0.27 KiB / gzip: 0.22 KiB
7:28:17 PM: dist/build/q-77279ebd.js    33.59 KiB / gzip: 14.07 KiB
7:28:17 PM: npm WARN config tmp This setting is no longer used.  npm stores temporary files in a special
7:28:17 PM: npm WARN config location in the cache, and they are managed by
7:28:17 PM: npm WARN config     [`cacache`](http://npm.im/cacache).
7:28:17 PM: > build.ssr
7:28:17 PM: > vite build --ssr src/entry.netlify.ts
7:28:18 PM: vite v3.0.2 building SSR bundle for production...
7:28:18 PM: transforming...
7:28:21 PM: ✓ 66 modules transformed.
7:28:21 PM: rendering chunks...
7:28:21 PM: .netlify/edge-functions/entry.netlify/entry.netlify.js   1633.06 KiB
7:28:21 PM: ​
7:28:21 PM: (build.command completed in 8.9s)
7:28:21 PM: ​
7:28:21 PM: ────────────────────────────────────────────────────────────────
7:28:21 PM:   2. Edge Functions bundling                                    
7:28:21 PM: ────────────────────────────────────────────────────────────────
7:28:21 PM: ​
7:28:21 PM: Packaging Edge Functions from .netlify/edge-functions directory:
7:28:21 PM:  - entry.netlify
7:28:22 PM: ​
7:28:22 PM: (Edge Functions bundling completed in 1.2s)
7:28:22 PM: ​
7:28:22 PM: ────────────────────────────────────────────────────────────────
7:28:22 PM:   3. Deploy site                                                
7:28:22 PM: ────────────────────────────────────────────────────────────────
7:28:22 PM: ​
7:28:22 PM: Starting to deploy site from 'dist'
7:28:22 PM: Creating deploy tree 
7:28:23 PM: Creating deploy upload records
7:28:23 PM: 20 new files to upload
7:28:23 PM: 0 new functions to upload
7:28:23 PM: Site deploy was successfully initiated
7:28:23 PM: ​
7:28:23 PM: (Deploy site completed in 571ms)
7:28:23 PM: ​
7:28:23 PM: ────────────────────────────────────────────────────────────────
7:28:23 PM:   Netlify Build Complete                                        
7:28:23 PM: ────────────────────────────────────────────────────────────────
7:28:23 PM: ​
7:28:23 PM: (Netlify Build completed in 10.7s)
7:28:23 PM: Starting post processing
7:28:23 PM: Post processing - HTML
7:28:23 PM: Caching artifacts
7:28:23 PM: Started saving node modules
7:28:23 PM: Finished saving node modules
7:28:23 PM: Started saving build plugins
7:28:23 PM: Finished saving build plugins
7:28:23 PM: Started saving pip cache
7:28:23 PM: Finished saving pip cache
7:28:23 PM: Started saving emacs cask dependencies
7:28:23 PM: Finished saving emacs cask dependencies
7:28:23 PM: Started saving maven dependencies
7:28:23 PM: Finished saving maven dependencies
7:28:23 PM: Started saving boot dependencies
7:28:23 PM: Finished saving boot dependencies
7:28:23 PM: Started saving rust rustup cache
7:28:23 PM: Finished saving rust rustup cache
7:28:23 PM: Started saving go dependencies
7:28:23 PM: Finished saving go dependencies
7:28:23 PM: Build script success
7:28:23 PM: Post processing - header rules
7:28:24 PM: Post processing - redirect rules
7:28:24 PM: Post processing done
7:28:24 PM: Uploading Cache of size 153.1MB
7:28:27 PM: Finished processing build request in 31.441140471s
7:28:27 PM: Site is live ✨

renanlopescoder avatar Aug 06 '22 17:08 renanlopescoder

Well, the edge log isn't the most helpful thing I've seen. 😄 Do you get any errors running locally?

nnelgxorz avatar Aug 06 '22 17:08 nnelgxorz

Locally the build runs the same as the pipeline, and running npm run start the app is loading normally, is there any command to run the built prod version locally?

renanlopescoder avatar Aug 06 '22 17:08 renanlopescoder

Hmm. Have you tried to clear the cache and redeploy? Other than that we might have to wait for the edge log to get working again.

nnelgxorz avatar Aug 06 '22 17:08 nnelgxorz

@renanlopescoder Try https://docs.netlify.com/netlify-labs/experimental-features/edge-functions/get-started/#test-locally I use those commands below to preview:

npm run build
netlify dev -d dist

Priestch avatar Aug 06 '22 18:08 Priestch

@Priestch can you try the latest release ?

updates on: npm create [email protected] , add following content into netlify.toml

[[edge_functions]]
path = "/*"
function = "entry.netlify"

now build & deploy successful

live on: https://yb-qwik-netlify-starters.netlify.app/

youngboy avatar Aug 10 '22 15:08 youngboy

Of course, I will try later.

Priestch avatar Aug 10 '22 23:08 Priestch

@youngboy I tried 0.0.42 and the latest 0.0.100, and both worked without any issues!

Priestch avatar Aug 12 '22 12:08 Priestch

Thanks for the help @youngboy! Are we ready to call this resolved?

nnelgxorz avatar Aug 12 '22 22:08 nnelgxorz

Thanks everyone!

adamdbradley avatar Aug 22 '22 21:08 adamdbradley