-
Notifications
You must be signed in to change notification settings - Fork 19
Description
Describe the bug
First I'm not 100% sure if this is a bug with Netlify (the Netlify CLI itself) or if it's related to this plugin. So hopefully someone with more insights can help here: when there is already a _redirects file defined in the static/ directory this plugin indeed does create correctly the following entry at the end of the file
## Created with gatsby-plugin-netlify
/foo/* / 301
# @netlify/plugin-gatsby redirects start
/api/* /.netlify/functions/gatsby 200
# @netlify/plugin-gatsby redirects end
but the Lambda function itself is not deployed. From the Netlify CLI I'm getting
(Netlify Build completed in 3m 26.6s)
Deploy path: /Users/me/Workspace/some-site/public
Configuration path: /Users/me/Workspace/some-site/netlify.toml
Deploying to draft URL...
✔ Finished hashing 4242 files
✔ CDN requesting 42 files
✔ Finished uploading 42 assets
✔ Deploy is live!When I completely remove the static/_redirects file the Netlify CLI output is
(Netlify Build completed in 3m 31.2s)
Deploy path: /Users/me/Workspace/some-site/public
Functions path: /Users/me/Workspace/some-site/netlify/functions
Configuration path: /Users/me/Workspace/some-site/netlify.toml
Deploying to draft URL...
✔ Deploying functions from cache (use --skip-functions-cache to override)
✔ Finished hashing 4242 files and 1 functions
✔ CDN requesting 42 files and 0 functions
✔ Finished uploading 42 assets
✔ Deploy is live!On the third line there is the indicator that the function is found and deployed. I'm using additionally gatsby-plugin-netlify in combination with @netlify/plugin-gatsby.
Steps to reproduce
- create a new Gatsby project
- create a Lambda function in
src/api/ - create a
static/_redirectsfile with one or more redirects. For example/foo/* / 301 - build the project with
npx netlify deploy --build
The same happens when a _redirects file is not present but created programatically in gatsby-node.js with
exports.createPages = async ({ actions }) => {
const { createRedirect } = actions;
createRedirect({
fromPath: '/foo/*',
toPath: '/',
statusCode: 301,
});
};Expected behavior
A Netlify Lambda function should be deployed
Configuration
Environment
$ npx envinfo --system --binaries --browsers --npmPackages @netlify/plugin-gatsby
System:
OS: macOS 12.1
CPU: (8) arm64 Apple M1
Memory: 2.16 GB / 16.00 GB
Shell: 5.8 - /bin/zsh
Binaries:
Node: 16.13.2 - /var/folders/85/8rb_y49j5911bg5qzd7tkddw0000gp/T/fnm_multishells/78765_1642439901724/bin/node
npm: 8.1.2 - /var/folders/85/8rb_y49j5911bg5qzd7tkddw0000gp/T/fnm_multishells/78765_1642439901724/bin/npm
Browsers:
Chrome: 97.0.4692.71
Edge: 97.0.1072.62
Firefox Developer Edition: 92.0
Safari: 15.2
npmPackages:
@netlify/plugin-gatsby: 1.0.3 => 1.0.3plus I'm using "gatsby-plugin-netlify": "3.14.0" and Gatsby v3 (3.14.5)
Screenshots
Can you submit a pull request?
No.