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

Cloudflare mode directory outputs [[path]] to root instead of ./function #6206

Closed
1 task
vampaz opened this issue Feb 10, 2023 · 1 comment · Fixed by #6208
Closed
1 task

Cloudflare mode directory outputs [[path]] to root instead of ./function #6206

vampaz opened this issue Feb 10, 2023 · 1 comment · Fixed by #6208
Labels
- P3: minor bug An edge case that only affects very specific usage (priority)

Comments

@vampaz
Copy link

vampaz commented Feb 10, 2023

What version of astro are you using?

2.0.10

Are you using an SSR adapter? If so, which one?

Cloudflare 6.1.2

What package manager are you using?

npm

What operating system are you using?

mac/Linux

Describe the Bug

Expected:
After build the file [[path]].js is saved at ./functions

Result:
After the build the file [[path]].js is saved at the root instead of the expected destination ./functions

When it started:
This was introduced when updating both astro and the cf adaptor(6.1.2) to the latest

How to reproduce:
npm run build in the provided stackblitz

Link to Minimal Reproducible Example

https://stackblitz.com/edit/withastro-astro-qbsvtj?file=astro.config.mjs

Participation

  • I am willing to submit a pull request for this issue.
@mfrachet
Copy link
Contributor

I think I m able to reproduce locally, but I don't know if it s a bug or not. Seems related to this LOC: https://github.com/withastro/astro/blob/main/packages/integrations/cloudflare/src/index.ts#L208

Also, adding the following assertion:

	it.only('generates functions folder inside the project root', async () => {
		expect(await fixture.pathExists('../functions')).to.be.true;
		expect(await fixture.pathExists('../functions/[[path]].js')).to.be.true; // this one
	});

In https://github.com/withastro/astro/blob/main/packages/integrations/cloudflare/test/directory.test.js#L19 could safe guard this behaviour.

Also, on a side note, running npm run build && npm test in cloudflare folder end up generating the [[path]].js file as a sibling of functions (probably the behaviour you mention).

I should be able to fix it (let me know if someone else wants to try fixing this one)

@matthewp matthewp added the - P3: minor bug An edge case that only affects very specific usage (priority) label Feb 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
- P3: minor bug An edge case that only affects very specific usage (priority)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants