netlify / netlify-plugin-gatsby

A build plugin to integrate Gatsby seamlessly with Netlify

Home Page:https://www.npmjs.com/package/@netlify/plugin-gatsby

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Bug]: Gatsby Functions is skipped even if they exists

sjelfull opened this issue · comments

Summary

I have a vanilla install of Gatsby + one Gatsby function. I installed to support Gatsby on Netlify.

Before upgrading to the newest version of gatsby-plugin-netlify it would detect functions as expected.

After upgrading, it skips building Gatsby functions.

(Cross-posting from netlify/gatsby-plugin-netlify#138 because i'm not sure what repo this belongs in)

Steps to reproduce

  1. Pull down
  2. Deploy to Netlify
  3. See message Skipping Gatsby Functions and SSR/DSG support because gatsby-plugin-netlify reported that this site does not use them.

A link to a reproduction repository

https://github.com/sjelfull/repro-gatsby-netlify-functions-plugin

Plugin version

2.0.0

More information about your build

  • I am building using the CLI
  • I am building using file-based configuration (netlify.toml)

What OS are you using?

Mac OS

Your netlify.toml file

No response

Configuration

gatsby-config.js
module.exports = {
  siteMetadata: {
    siteUrl: `https://www.yourdomain.tld`,
  },
  plugins: [
    'gatsby-plugin-netlify',
  ],
}

Environment

Environment
# Paste output from `npx envinfo` here.

Gatsby info

Gatsby info
  System:
    OS: macOS 10.15.7
    CPU: (16) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
    Shell: 5.7.1 - /bin/zsh
  Binaries:
    Node: 16.11.1 - ~/.nvm/versions/node/v16.11.1/bin/node
    Yarn: 1.21.1 - /usr/local/bin/yarn
    npm: 8.5.3 - ~/.nvm/versions/node/v16.11.1/bin/npm
  Languages:
    Python: 3.9.12 - /usr/local/opt/python/libexec/bin/python
  Browsers:
    Chrome: 101.0.4951.64
    Firefox: 100.0.2
    Safari: 15.3
  npmPackages:
    gatsby: ^4.15.0 => 4.15.0
    gatsby-plugin-netlify: ^5.0.0 => 5.0.0

Your _redirects file

`_redirects`
# Paste content of your `_redirects` file here

Builds logs (or link to your logs)

Build logs
1:02:55 PM: Python version set to 2.7
1:02:50 PM: Build ready to start
1:02:52 PM: build-image version: d2c6dbeac570350a387d832f64bc980dc964ad65 (focal)
1:02:52 PM: build-image tag: v4.8.0
1:02:52 PM: buildbot version: 17f6c1ab2fe6d61574ce02b038041b816bf6c085
1:02:52 PM: Fetching cached dependencies
1:02:52 PM: Failed to fetch cache, continuing with build
1:02:52 PM: Starting to prepare the repo for build
1:02:53 PM: No cached dependencies found. Cloning fresh repo
1:02:53 PM: git clone https://github.com/sjelfull/repro-gatsby-netlify-functions-plugin
1:02:53 PM: Preparing Git Reference refs/heads/main
1:02:53 PM: Parsing package.json dependencies
1:02:55 PM: Starting build script
1:02:55 PM: Installing dependencies
1:02:56 PM: Downloading and installing node v16.15.0...
1:02:56 PM: Downloading https://nodejs.org/dist/v16.15.0/node-v16.15.0-linux-x64.tar.xz...
1:02:56 PM: Computing checksum with sha256sum
1:02:56 PM: Checksums matched!
1:03:00 PM: Now using node v16.15.0 (npm v8.5.5)
1:03:00 PM: Started restoring cached build plugins
1:03:00 PM: Finished restoring cached build plugins
1:03:00 PM: Attempting ruby version 2.7.2, read from environment
1:03:02 PM: Using ruby version 2.7.2
1:03:02 PM: Using PHP version 8.0
1:03:02 PM: No npm workspaces detected
1:03:02 PM: Started restoring cached node modules
1:03:02 PM: Finished restoring cached node modules
1:03:03 PM: Installing NPM modules using NPM version 8.5.5
1:03:18 PM: npm WARN deprecated querystring@0.2.1: The querystring API is considered Legacy. new code should use the URLSearchParams API instead.
1:03:24 PM: npm WARN deprecated subscriptions-transport-ws@0.9.19: The `subscriptions-transport-ws` package is no longer maintained. We recommend you use `graphql-ws` instead. For help migrating Apollo software to `graphql-ws`, see https://www.apollographql.com/docs/apollo-server/data/subscriptions/#switching-from-subscriptions-transport-ws    For general help using `graphql-ws`, see https://github.com/enisdenjo/graphql-ws/blob/master/README.md
1:03:25 PM: npm WARN deprecated async-cache@1.1.0: No longer maintained. Use [lru-cache](http://npm.im/lru-cache) version 7.6 or higher, and provide an asynchronous `fetchMethod` option.
1:03:56 PM: added 1519 packages, and audited 1520 packages in 52s
1:03:56 PM: 205 packages are looking for funding
1:03:56 PM:   run `npm fund` for details
1:03:56 PM: 18 vulnerabilities (3 moderate, 15 high)
1:03:56 PM: To address issues that do not require attention, run:
1:03:56 PM:   npm audit fix
1:03:56 PM: To address all issues (including breaking changes), run:
1:03:56 PM:   npm audit fix --force
1:03:56 PM: Run `npm audit` for details.
1:03:56 PM: NPM modules installed
1:03:57 PM: Started restoring cached go cache
1:03:57 PM: Finished restoring cached go cache
1:03:57 PM: go version go1.16.5 linux/amd64
1:03:57 PM: go version go1.16.5 linux/amd64
1:03:57 PM: Installing missing commands
1:03:57 PM: Verify run directory
1:03:58 PM: ​
1:03:58 PM: ────────────────────────────────────────────────────────────────
1:03:58 PM:   Netlify Build                                                 
1:03:58 PM: ────────────────────────────────────────────────────────────────
1:03:58 PM: ​
1:03:58 PM: ❯ Version
1:03:58 PM:   @netlify/build 27.1.3
1:03:58 PM: ​
1:03:58 PM: ❯ Flags
1:03:58 PM:   baseRelDir: true
1:03:58 PM:   buildId: 628f5e5a36ecda55fc2b15a5
1:03:58 PM:   deployId: 628f5e5a36ecda55fc2b15a7
1:03:58 PM: ​
1:03:58 PM: ❯ Current directory
1:03:58 PM:   /opt/build/repo
1:03:58 PM: ​
1:03:58 PM: ❯ Config file
1:03:58 PM:   No config file was defined: using default values.
1:03:58 PM: ​
1:03:58 PM: ❯ Context
1:03:58 PM:   production
1:03:59 PM: ​
1:03:59 PM: ❯ Installing plugins
1:03:59 PM:    - @netlify/plugin-gatsby@3.0.0
1:04:12 PM: ​
1:04:12 PM: ❯ Loading plugins
1:04:12 PM:    - @netlify/plugin-gatsby@3.0.0 from Netlify app
1:04:14 PM: ​
1:04:14 PM: ────────────────────────────────────────────────────────────────
1:04:14 PM:   1. @netlify/plugin-gatsby (onPreBuild event)                  
1:04:14 PM: ────────────────────────────────────────────────────────────────
1:04:14 PM: ​
1:04:14 PM: No Gatsby cache found. Building fresh.
1:04:14 PM: ​
1:04:14 PM: (@netlify/plugin-gatsby onPreBuild completed in 24ms)
1:04:14 PM: ​
1:04:14 PM: ────────────────────────────────────────────────────────────────
1:04:14 PM:   2. Build command from Netlify app                             
1:04:14 PM: ────────────────────────────────────────────────────────────────
1:04:14 PM: ​
1:04:14 PM: $ npm run build
1:04:15 PM: > repro-netlify-functions-plugin@1.0.0 build
1:04:15 PM: > gatsby build
1:04:19 PM: success compile gatsby files - 1.137s
1:04:19 PM: success load gatsby config - 0.031s
1:04:19 PM: success load plugins - 0.308s
1:04:19 PM: success onPreInit - 0.001s
1:04:19 PM: success initialize cache - 0.077s
1:04:19 PM: success copy gatsby files - 0.099s
1:04:20 PM: success Compiling Gatsby Functions - 0.479s
1:04:20 PM: success onPreBootstrap - 0.494s
1:04:20 PM: success createSchemaCustomization - 0.000s
1:04:20 PM: success Checking for changed pages - 0.000s
1:04:20 PM: success source and transform nodes - 0.107s
1:04:20 PM: info Writing GraphQL type definitions to /opt/build/repo/.cache/schema.gql
1:04:21 PM: success building schema - 0.703s
1:04:21 PM: success createPages - 0.001s
1:04:21 PM: success createPagesStatefully - 0.317s
1:04:21 PM: info Total nodes: 26, SitePage nodes: 3 (use --verbose for breakdown)
1:04:21 PM: success Checking for changed pages - 0.000s
1:04:21 PM: success onPreExtractQueries - 0.000s
1:04:21 PM: success extract queries from components - 0.446s
1:04:21 PM: success write out redirect data - 0.056s
1:04:21 PM: success onPostBootstrap - 0.000s
1:04:21 PM: info bootstrap finished - 6.706s
1:04:21 PM: success write out requires - 0.066s
1:04:36 PM: success Building production JavaScript and CSS bundles - 14.707s
1:04:49 PM: success Building HTML renderer - 13.001s
1:04:49 PM: success Execute page configs - 0.044s
1:04:49 PM: success Caching Webpack compilations - 0.000s
1:04:49 PM: success run queries in workers - 0.025s - 3/3 121.08/s
1:04:49 PM: success Merge worker state - 0.001s
1:04:49 PM: success Rewriting compilation hashes - 0.001s
1:04:49 PM: success Writing page-data.json files to public directory - 0.002s - 3/3 1221.21/s
1:04:54 PM: success Building static HTML for pages - 4.202s - 3/3 0.71/s
1:04:54 PM: info [gatsby-plugin-netlify] Creating SSR/DSG redirects...
1:04:54 PM: info [gatsby-plugin-netlify] Created 0 SSR/DSG redirects...
1:04:54 PM: success onPostBuild - 0.005s
1:04:54 PM: 
1:04:54 PM: Pages
1:04:54 PM: ┌ src/pages/404.js
1:04:54 PM: │ ├   /404/
1:04:54 PM: │ └   /404.html
1:04:54 PM: ├ src/pages/index.js
1:04:54 PM: │ └   /
1:04:54 PM: └ src/api/test.js
1:04:54 PM:   └ λ /api/test
1:04:54 PM:   ╭────────────────────────────────────────────────────────────────────╮
1:04:54 PM:   │                                                                    │
1:04:54 PM:   │     (SSG) Generated at build time                                  │
1:04:54 PM:   │   D (DSG) Deferred static generation - page generated at runtime   │
1:04:54 PM:   │   ∞ (SSR) Server-side renders at runtime (uses getServerData)      │
1:04:54 PM:   │   λ (Function) Gatsby function                                     │
1:04:54 PM:   │                                                                    │
1:04:54 PM:   ╰────────────────────────────────────────────────────────────────────╯
1:04:54 PM: info Done building in 38.97003361 sec
1:04:54 PM: ​
1:04:54 PM: Creating deploy upload records
1:04:54 PM: (build.command completed in 39.5s)
1:04:54 PM: ​
1:04:54 PM: ────────────────────────────────────────────────────────────────
1:04:54 PM:   3. @netlify/plugin-gatsby (onBuild event)                     
1:04:54 PM: ────────────────────────────────────────────────────────────────
1:04:54 PM: ​
1:04:54 PM: Skipping Gatsby Functions and SSR/DSG support because gatsby-plugin-netlify reported that this site does not use them.
1:04:54 PM: If this is incorrect, remove the file "/opt/build/repo/.cache/.nf-skip-gatsby-functions" and try again.
1:04:54 PM: ​
1:04:54 PM: (@netlify/plugin-gatsby onBuild completed in 5ms)
1:04:54 PM: ​
1:04:54 PM: ────────────────────────────────────────────────────────────────
1:04:54 PM:   4. @netlify/plugin-gatsby (onPostBuild event)                 
1:04:54 PM: ────────────────────────────────────────────────────────────────
1:04:54 PM: ​
1:04:54 PM: Could not check zip size because /tmp/zisi-628f5e5a36ecda55fc2b15a7/__api.zip does not exist
1:04:54 PM: Could not check zip size because /tmp/zisi-628f5e5a36ecda55fc2b15a7/__dsg.zip does not exist
1:04:54 PM: Could not check zip size because /tmp/zisi-628f5e5a36ecda55fc2b15a7/__ssr.zip does not exist
1:04:55 PM: Starting post processing
1:04:54 PM: ​
1:04:54 PM: (@netlify/plugin-gatsby onPostBuild completed in 474ms)
1:04:54 PM: ​
1:04:54 PM: ────────────────────────────────────────────────────────────────
1:04:55 PM: Post processing - HTML
1:04:54 PM:   5. Deploy site                                                
1:04:54 PM: ────────────────────────────────────────────────────────────────
1:04:54 PM: ​
1:04:54 PM: Starting to deploy site from 'public'
1:04:54 PM: Creating deploy tree 
1:04:55 PM: 6 new files to upload
1:04:55 PM: 0 new functions to upload
1:04:55 PM: Site deploy was successfully initiated
1:04:55 PM: ​
1:04:55 PM: (Deploy site completed in 784ms)
1:04:55 PM: ​
1:04:55 PM: ────────────────────────────────────────────────────────────────
1:04:55 PM:   Netlify Build Complete                                        
1:04:55 PM: ────────────────────────────────────────────────────────────────
1:04:55 PM: ​
1:04:55 PM: (Netlify Build completed in 56.6s)
1:04:55 PM: Caching artifacts
1:04:55 PM: Started saving node modules
1:04:55 PM: Finished saving node modules
1:04:56 PM: Post processing - header rules
1:04:55 PM: Started saving build plugins
1:04:55 PM: Finished saving build plugins
1:04:55 PM: Started saving pip cache
1:04:55 PM: Finished saving pip cache
1:04:55 PM: Started saving emacs cask dependencies
1:04:56 PM: Post processing - redirect rules
1:04:55 PM: Finished saving emacs cask dependencies
1:04:55 PM: Started saving maven dependencies
1:04:56 PM: Finished saving maven dependencies
1:04:56 PM: Post processing done
1:04:56 PM: Started saving boot dependencies
1:04:56 PM: Finished saving boot dependencies
1:04:56 PM: Started saving rust rustup cache
1:04:56 PM: Finished saving rust rustup cache
1:04:56 PM: Started saving go dependencies
1:04:56 PM: Finished saving go dependencies
1:04:58 PM: Build script success
1:04:59 PM: Site is live ✨
1:05:44 PM: Finished processing build request in 2m51.460683907s

Function logs

Function logs
# Paste logs here

Hi @sjelfull, sorry for the delay in responding and thanks for the repro. An update to @netlify/plugin-gatsby will cure your woes. There was a change in v4.3.1 of gatsby-plugin-netlify that requires a corresponding change in v3.1.0 of @netlify/plugin-gatsby. It was designed to be backward compatible if you update @netlify/plugin-gatsby and forget to update gatsby-plugin-netlify, but it looks like we overlooked the opposite scenario.

Closing due to inactivity, but please reopen if still an issue