Deployed filenames cannot contain # or ? characters

Moving a site from Gatsby Cloud to Netlify before the end of the month.

Having trouble deploying with the error message:-

Deploy did not succeed: Invalid filename ‘static/d216e4e65f0e556ed57068a79595767d/f836f/1584486378001?e=1626912000&v=beta&t=D-7MuQce_K02ILOfio3uk9Vv_Jhj7AdTL9GBVNHbXIc.jpg’. Deployed filenames cannot contain # or ? characters

This is something that is created during the build I think so I’m nt sure how to stop it having # or ? in.

This has deployed fine on Gatsby Cloud. All environment variables match. Did have to downgrade node to 16.

Any advice helpful

Why would your file have ? or # in the name? Those are supposed to be query params and hash strings respectively. This is not something we can help with. You need to find a way to prevent those characters from being included in those file names.

As far as I know they don’t

This is something being spit out at build time.

There are no routes in the site with ? or #.

This code is building on gatsby cloud fine. But that service is sunsetting in a few weeks so moving over to netlify. I thought it would build fine, but getting this error message

This is not a building problem, so comparing Netlify and Gatsby Cloud is probably not the best idea. Gatsby Cloud might be allowing you to deploy files with those characters, but Netlify does not. Try running a production build locally and see if you get those files.

I cant find any evidence of a file with this ? in.

It’s being spat out by gatsby and is working fine in gatsby cloud.

But when the same commit sourcing the same data is on netlify it fails with this error message.

I’d really appreciate some help as Gatsby Cloud dies in a week and I need to get the site transferred to netlify to avoid downtime for the site.

I would have thought this migration would have been easy and would have had more hand holding.

Have done a local build and can’t see any files in the static folder with a # or a ?

CleanShot 2023-09-22 at 13.21.38@2x
CleanShot 2023-09-22 at 13.21.38@2x
2706×670 117 KB

I’ve managed to find the problem.

One of the users of the site had uploaded an image with the offending ? in the filename. I have now changed that and it’s building correctly.

I wonder why this was thrown up in netlify but not in GC?

All solved now though.

glad you found your solution thanks for sharing with the community!