Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛 BUG: Static page with a category named 'functions' (public/functions/index.html) gets discarded #2240

Open
R-CoderDotCom opened this issue Nov 18, 2022 · 8 comments
Assignees
Labels
bug Something that isn't working pages Relating to Pages

Comments

@R-CoderDotCom
Copy link

What version of Wrangler are you using?

0.0.0

What operating system are you using?

Windows

Describe the Bug

I have a tutorials website made with HUGO on CF Pages and the public folder of the site is hosted on GitHub. Since the general release of CF functions a couple of days ago (11/15/22) the section of my site named ‘functions’, vanished off, this is, example.com/functions/ returns a 404 despite the page exists on the repository inside the public/functions folder. It seems that CF Pages discards that section because of its name. Maybe, this behaviour could be addresed cheking if there is an index.html inside the functions folder

As I wouldn’t like to change the name of the section of my site I'm wondering if there’s any way to solve this issue that could potentially affect any page on CF Pages with a 'functions' section.

I'm writing an issue here following the advice reveived on CF community:
https://community.cloudflare.com/t/cf-pages-excluding-public-functions-folder-of-a-hugo-website/436010

@R-CoderDotCom R-CoderDotCom added the bug Something that isn't working label Nov 18, 2022
@lrapoport-cf lrapoport-cf moved this to Untriaged in workers-sdk Nov 22, 2022
@amochkin
Copy link

Experiencing the same problem. The functions directory and its HTML contents is completely ignored.

@Cherry
Copy link
Contributor

Cherry commented Dec 8, 2022

@amochkin
Copy link

amochkin commented Dec 8, 2022

We are fixing this problem with:

mv docs/functions docs/funcs && sed -i'.bak' 's/href=\"functions/href=\"funcs/g' docs/*.html

@NullVoxPopuli
Copy link

I had to do this:

mv dist/functions dist/funcs  
find ./dist -type f -name '*.html' \
  | xargs sed -i.bak --regexp-extended 's:(href="[^"]+)functions/:\1funcs/:g' 

to account for deeply nested html files, and functions appearing anywhere in the href due to relative pathing.

Cloudflare, this took too long for me to figure out (I'm not a sed expert), and I shouldn't have to do this anyway. Not happy. 😢

@KianNH
Copy link
Contributor

KianNH commented Jan 5, 2023

This is a relatively old issue now that's impacted numerous users - with the symptoms made worse that there is no output to indicate that the functions folder is being ignored.

https://github.com/cloudflare/wrangler2/blob/32686e42b055c786f9821bbd66dd33960ab8f4d1/packages/wrangler/src/pages/upload.tsx#L111-L120

Can't this either:

  • Be removed & replaced with a warning/error informing the user that their actual functions folder may misplaced.

  • Be user-configurable with a flag/environment variable to either remove it from the list, or suppress the above warning/error.

At the very least, users should be made aware that folders are being ignored.

@targos
Copy link

targos commented Jan 18, 2023

Hello, we just stumbled upon this issue while deploying a Storybook v7 build.
In our case, part of the build files are in a node_modules directory. For example: /sb-addons/node_modules/%40storybook/addon-essentials/dist/controls/manager-bundle.mjs

@penalosa penalosa added the pages Relating to Pages label Jun 30, 2023
@Cherry
Copy link
Contributor

Cherry commented Aug 19, 2023

People are still hitting this bug: https://discord.com/channels/595317990191398933/1142480994734178346/1142480994734178346

It used to work quite some time ago, but #2103 introduced this as a breaking change. That PR fixed other things, but this functionality was never revisited as a regression.

mergify bot added a commit to Agoric/agoric-sdk that referenced this issue Aug 8, 2024
closes: #9681
refs: #9729

## Description

- Updates typedoc to latest version
- Adds script to rewrite `/functions` path to `/funcs` to avoid cloudflare/workers-sdk#2240
   - includes renaming files, anchor links in html files, and a base64 encoded navigation state object in a js file

### Security Considerations
n/a

### Scaling Considerations
n/a

### Documentation Considerations
n/a

### Testing Considerations
CI and manual QA

### Upgrade Considerations
n/a
@j0nl1
Copy link

j0nl1 commented Aug 17, 2024

I just created a script that solve this issue. It could be include in your pipeline using the next code:

      - name: Build Doc
        run: |
          # Replace with your doc command
          pnpm doc
          curl -O https://gist.githubusercontent.com/j0nl1/7f9b5210c9e6ecbabe322baa16dcb5db/raw/760de77327bf83671cfb6bd4e64181299ba26113/typedoc-fix-cf.mjs
          # Replace docs for your folder path it uses the folder where was downloaded like root path (its a mandatory provide a path)
          node typedoc-fix-cf.mjs docs

jaredallard added a commit to rgst-io/stencil that referenced this issue Oct 3, 2024
jaredallard added a commit to rgst-io/stencil that referenced this issue Oct 3, 2024
Cloudflare treats the "functions" dir as a special directory, so files
in this dir will not be deployed. This is now fixed by changing that
directory to "funcs" instead.

See cloudflare/workers-sdk#2240
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something that isn't working pages Relating to Pages
Projects
None yet
Development

No branches or pull requests

9 participants