Trying to deploy my AdonisJS back-end using Serverless on a Cloudflare Worker, It fails telling me env is missing

107 views Asked by At

I am trying to deploy my adonisjs backend on a cloudflare worker node using serverless, but when I run the yml file using serverless deploy it gives me an error:

Warning: You're relying on provider "cloudflare" defined by a plugin which doesn't provide a validation schema for its config.
Please report the issue at its bug tracker linking: https://www.serverless.com/framework/docs/providers/aws/guide/plugins#extending-validation-schema
You may turn off this message with "configValidationMode: off" setting

× Uncaught exception
Environment: win32, node 20.2.0, framework 3.38.0, plugin 7.2.0, SDK 4.5.1
Docs:        docs.serverless.com
Support:     forum.serverless.com
Bugs:        github.com/serverless/serverless/issues

Error:
'Missing mandatory environment variable: CLOUDFLARE_AUTH_KEY.'

C:\Vscode local\FsAssignment2\adonis-todo\new-project\node_modules\bluebird\js\release\async.js:49
        fn = function () { throw arg; };
                           ^
Missing mandatory environment variable: CLOUDFLARE_AUTH_EMAIL.
(Use `node --trace-uncaught ...` to show where the exception was thrown)

Node.js v20.2.0

this is my serverless.yaml file with the values removed

service: new-project

frameworkVersion: '3'

provider:
  name: cloudflare
  environment:
    CLOUDFLARE_ACCOUNT_ID: 
    CLOUDFLARE_AUTH_EMAIL: 
    CLOUDFLARE_AUTH_KEY: 
  config:
    accountId: 
    authEmail: 
    authKey: 

plugins:
  - serverless-cloudflare-workers

functions:
  adonis-todo:
    name: adonis-todo
    script: ..\cloudflareWorker.js # there must be a file called helloWorld.js
    events:
      - http:
          url: https://simon-floyd-proceed-example.trycloudflare.com/hello/*
          method: GET
          headers:
            foo: bar
            x-client-data: value

even setting the env variable values using set or setx doesn't fix the issue, Adding an env file and adding values using that doesn't fix it either. Hopefully someone else has used serverless to deploy to cloudflare workers and knows this better

I was trying to deploy my adonisjs back end using serverless I was expecting a deployment successful message as I have provided everything that the error message says is missing, I added an env file, added it in the yaml, tried using set and setx and I was expecting the message to go away

0

There are 0 answers