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

"Uncaught Error: No such module" using cloudflare_snippets #5017

Open
3 tasks done
devin-purple opened this issue Jan 31, 2025 · 0 comments
Open
3 tasks done

"Uncaught Error: No such module" using cloudflare_snippets #5017

devin-purple opened this issue Jan 31, 2025 · 0 comments
Labels
kind/bug Categorizes issue or PR as related to a bug. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one.

Comments

@devin-purple
Copy link

Confirmation

  • This is a bug with an existing resource and is not a feature request or enhancement. Feature requests should be submitted with Cloudflare Support or your account team.
  • I have searched the issue tracker and my issue isn't already found.
  • I have replicated my issue using the latest version of the provider and it is still present.

Terraform and Cloudflare provider version

OpenTofu v1.8.7
on linux_amd64

  • provider registry.opentofu.org/cloudflare/cloudflare v5.0.0

Affected resource(s)

cloudflare_snippets

Terraform configuration files

resource "cloudflare_snippets" "xxx" {
  zone_id = yyy
  snippet_name = "xxx"
  files  = "export default { async fetch(request) {} }"
  metadata = {
    main_module = "snippet.js"
  }
}

Link to debug output

https://gist.github.com/devin-purple/80531791220402898a10cca86251bfad

Panic output

No response

Expected output

Snippet created

Actual output

╷
│ Error: failed to make http request
│ 
│   with cloudflare_snippets.tealium_client_info,
│   on tealium-client-ip.tf line 15, in resource "cloudflare_snippets" "tealium_client_info":
│   15: resource "cloudflare_snippets" "tealium_client_info" {
│ 
│ PUT "https://api.cloudflare.com/client/v4/zones/873d482250570299a000b59e656a46c9/snippets/tealium_client_info": 400 Bad Request {"success":false,"errors":[{"message":"Uncaught Error: No such module
│ \"33744/snippet.js\".\n  imported from \"main.js\"\n"}],"result":null}
│ 

Steps to reproduce

Use example TF.

Additional factoids

It seems like in the API request, the provider is sending Content-Disposition: form-data; name="files" instead of the actual name of the file.

In V4 you could send a map in files. In V5 it can only be a string.

References

No response

@devin-purple devin-purple added kind/bug Categorizes issue or PR as related to a bug. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels Jan 31, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Categorizes issue or PR as related to a bug. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one.
Projects
None yet
Development

No branches or pull requests

1 participant